Pages

Wednesday, 24 December 2014

Building Custom Snippets in Sublime Text 3!!

Friends, In this post i am gonna show to build and use your own Snippets in sublime text 3!!
First you must have Sublime text 3 installed in your system!! You can download sublime text 3 from here ... LINK

Snippets basically makes your programming life easy in sublime text 3!!
here is your sublime text 3 ...


So for building a Snippet you have to go to Tools option in sublime text 3 ... and select the New Snippet Option!!



a default file opens with bunch of lines of code as shown in the picture below




So lets understand the code written in the default files ...

1.) There is a CONTENT tag in which we have to write contents or code which we wanna use many and many times in our programming languages .. like JAVA, PHP and all other languages!!
2.)${1:this} means when we supply our small snippets and hit tab 1st time then it will stop at "this"same as ${2:snippet} for 2nd time of tabtriggering 
3.)So now i'm gonna make build a Snippet for JAVA Programming language.. as shown in the picture below!!


save the file as p.sublime-snippet as your snippet name as shown in the picture below ...

now whenever during coding you press p and hit enter the following code will appear on the screen and with

With the item selected which we supplied in the ${1:/*ClassSwap*/} and when you will hit tab
it will select the next item which you supplied in ${2:/*CodeSwap*/} as shown in the picture below


and this will surely save a lot of your time during coding :) This was just a example!! You can build as big as big snippet for your requirement ... Thanks for giving your valueable time on reading this post .. Happy Coding :) 

No comments:

Post a Comment