So, I was following the approach to bind console.log function to shorter name. Here's another technique which is specific to Sublime Text.
Using Sublime TextÂ Snippets option, you can create a shortcut to a template and then you can insert that template in multiple places just by triggering the shortcut. Here's how I did it so that every time, I typeÂ echo, Sublime Text converts it intoÂ console.log();
Go toÂ Tools -> New Snippet. Sublime will open a template in a new file. Now make sure you have this content in that file (or change it the way you want).
<snippet> <content><![CDATA[ console.log( ]]></content> <!-- Optional: Set a tabTrigger to define how to trigger the snippet --> <tabTrigger>echo</tabTrigger> --> <!-- Optional: Set a scope to limit where the snippet will trigger --> <scope>source.js</scope> </snippet>
Then save this snippet file asÂ echo.sublime-snippet underÂ Packages/User folder. To find the location ofÂ Packages/User folder, in Sublime, go toÂ Preferences -> Browser packages and note the location.