Search code examples
jquerytextmatetextmatebundles

how do I configure textmate to auto-replace words when combined with `?


How do I configure TextMate to auto-replace jquerycdn` with "http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js" ?


Solution

  • I don't think you can "auto-replace" such that typing it automatically replaces it with your URL, but you can create a snippet and so that you can type "jquerycdn[TAB]" and have it replace that with your URL, which is almost as good I suppose.

    To create a snippet that works when editing HTML files select Bundles>Bundle Editor>Show Bundle Editor (Cmd-Opt-Ctrl-B). Find the HTML bundle and select it. Click the plus button below the list of bundles and choose New Snippet. Name it something useful (perhaps just "jquerycdn") and enter your URL in the large text area on the right. Leave the Activation as Tab Trigger and enter "jquerycdn" in the text field to the right of that menu. Set the scope to "text.html". Open or create an HTML document and try it out by typing "jquerycdn[TAB]".