Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create console.log snippet in Sublime Text 3?

I do not know how to do it I want to write first of all code, then press TAB and this code will be wrapped in brackets with console.log command. Help please)

like image 257
Nikita Shchypylov Avatar asked Feb 01 '16 17:02

Nikita Shchypylov


1 Answers

Here is my approach - Sublime Text 3 (3126) @ Ubuntu 16.04.

Open Sublime Text editor and go to:

Tools -> Developer -> New Snippet...

Then paste the following code:

<snippet>
    <content><![CDATA[console.log(${1:}$SELECTION);${0}]]></content>    
    <tabTrigger>console.log</tabTrigger>    
    <scope>text.plain, source.js</scope>
</snippet>

(<scope></scope> is optional, and feel free to put whatever you want in <tabTrigger></tabTrigger> section)

Press CTRL + S, choose name (e.g. console.log.sublime-snippet) and save it.

Open any JS file, start typing console and the snippet will appear.

like image 101
djordjea Avatar answered Oct 19 '22 14:10

djordjea