How to create snippets in sublime ?

By Hardik Savani | March 26, 2016 | | 750 Viewer | Category : Sublime

Share this post:

nowdays sublime is a very popular text edir in the developing field. sublime text editor is provide lots of packages like code formatter, php syntax etc. sublime is also provide snippet. snippet is very intrsting point because if you need to write same code lots of time than you can create shortcut name for that command content. For example if you want to write text "lorem ipsum" then you can just write just "lorem" and get whole lorem text. In following example i create snippet "debug" for debug code of PHP.

If you write just "debug" you can find autocomplete with debug snippet and just click on it and find follwing code.

Name Of Snippet


Snippet Result

echo "<pre>";print_r(this);exit;

First Click on "tools" on menubar and click at last "New snippet..." then can see new file open and put following code.

Snippet Code



echo "<pre>";print_r(${1:this});exit;



<!-- Optional: Set a tabTrigger to define how to trigger the snippet -->

<!-- <tabTrigger>hello</tabTrigger> -->

<!-- Optional: Set a scope to limit where the snippet will trigger -->

<!-- <scope>source.python</scope> -->


and save name should "dbug.sublime-snippet" and then write "dbug" on your php file and try this....