sublime text 2 jquery snippets in any file
In the last month or so I’ve switched over to using sublime text 2 as my main editor. Previous to this I was using notepad++ which did a great job but sublime just takes things to the next level with its editing capabilities and packages. Anyway I installed the jQuery snippets package which if you haven’t tried is pretty awesome. Its a handy little addon that allows you to type things like $.ready and press tab and it will create the full document.ready code you usually dump your jquery within. Pretty neat, the problem is it only appears to give these snippets in a pure javascript syntax file, if you are working in say a coldfusion file which may have a mix of html, javascript and coldfusion it won’t give you these great snippets. Well if you are like me and it bothers you here is a little fix. Open up your jquery packages folder and go into the syntaxes folder it should be located somewhere like here C:\Users\yourusername\AppData\Roaming\Sublime Text 2\Packages\jQuery\Syntaxes Now open up the jQueryJavaScript.tmLanguage file and find the section at the beginning that mentions fileTypes. You see there is an array, add in another string or as many as you like for other filetypes you want the snippets to be supported in. For the time being I’ve just added in coldfusion like so.
<key>fileTypes</key>
<array>
<string>js</string>
<string>cfm</string>
</array>
Comments
Comments are currently closed