How to get Zen Coding to support JavaScript files in Sublime Text2?

RT ~ Sublime Text2 is one of my favorite editors. The only problem for me is that its Zen Coding plugin only supports css and html files. But there are many situations that use Zen Coding in JavaScript or other files. Similarly, use the html template in js or concat lines in js.

And I checked his pakage file in ~ / .config / sublime-text-2 / Packages / ZenCoding. But I do not know how to configure it to support more files.

+2
source share
1 answer

Open packages /ZenCoding/sublimezenplugin.py Immediately after the `########## CONSTANTS #########, should be:

HTML = 'text.html - source' XML = 'text.xml' 

Add the following:

 JS = 'source.js' 

Then scroll down to the place where it says:

 ZEN_SCOPE = ', '.join([HTML, XML, CSS]) 

And change this to:

 ZEN_SCOPE = ', '.join([HTML, XML, CSS, JS]) 

This activates zencoding in JS files; however, be careful that Zencoding will ALWAYS be active in js files. If you want to limit the scope to, say, strings in JS, you can change the scope. JS string string.quoted.double.js for double quotes and string.quoted.single.js . You can add both of them to the string JS = ... Feel free to experiment with features that suit your taste. For more information on areas, see the documentation here: http://readthedocs.org/docs/sublime-text-unofficial-documentation/en/latest/extensibility/syntaxdefs.html

In addition, to see the current area immediately below the cursor, the key binding for Windows / Linux is ctrl+alt+shift+p , and for OSX - alt+command+p .

+3
source

Source: https://habr.com/ru/post/1484476/


All Articles