Is there a way to create shortcuts on sublime for words used often?

Viewed 17

For instance, I use System.out.println a lot is there a way I can create a much smaller term that will automatically include the whole command. Similar to how when you write main you can tab into the whole "public static void main(String[] args)". Thank you.

1 Answers

Yes, this can be done using snippets, .sublime-completions files, or customized plugins. See the full documentation on completions here. The unofficial docs also have a completions section.

The following snippet will create System.out.println() from the sop shortcut, with the cursor between the parentheses ():

<snippet>
    <content><![CDATA[
System.out.println($0)
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>sop</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.java</scope>
</snippet>
Related