Reputation: 10822
I want to have shortcut commands in sublime text 2.
I want to simply type sopl
and press tab
to generate System.out.println('text');
with the word 'text'
selected and ready for me to replace it.
I want to simply type sop
and press tab
to generate System.out.print('text');
with the word 'text'
selected and ready for me to replace it.
I have installed SublimeJava plugin but apparently there is no such short cut
Upvotes: 11
Views: 13087
Reputation: 11
it is very simple, just go to Tools>Developer>New Snippet..
remove all the code there and copy paste the below code...
<snippet>
<content><![CDATA[System.out.println("${1:text}");]]></content>
<tabTrigger>sysout</tabTrigger>
<scope>source.java</scope>
</snippet>
now press ctrl+s
and give some name (make sure that you're saving file with .sublime-snippet
extension) and click on save.
now open any .java file and type sysout
and press tab
that is it...
you can also refer this article for more info..
Upvotes: 0
Reputation: 128899
You're looking for pl<tab>
for System.out.println(|);
and p<tab>
for System.out.print(|);
. It doesn't put the 'text'
, but it does put your cursor in the right place to type. Also note that, like Eclipse or IntelliJ, when you expand a Snippet, Tab
will continue to move you through the positions in the Snippet until you've filled in all the blanks.
These are called "Snippets", and you can find them under Tools -> Snippets...
. You can add new ones with Tools -> New Snippet...
.
Upvotes: 24