Key-bindings for public static void main() and System.out.println() in Sublime Text 2

java, sublimetext2

Solution

You can use snippets.

`Tools/New Snippet...`:

<snippet>
    <content><![CDATA[
System.out.println()
]]></content>
    <tabTrigger>sop</tabTrigger>
    <scope>source.java</scope>
</snippet>

Save this file with `.sublime-snippet` extension, in `Packages/User`.

This way, in Java source files, when you type `sop`, followed by tab, you'll get what you need.

You can do the same for `psvm`.

Problem

I have recently gone from coding java in emacs to doing it in sublime text 2. I would like to know how to create key bindings such that if I type sop I'll get System.out.println() and if I type psvm I'll get public static void main. I'm using Sublime Text 2 for Ubuntu. Thanks in advance!

Original source