简体   繁体   中英

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

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM