user15443806
user15443806

Reputation:

How to add new snippets in Sublime Text

I know how to create snippets in VS Code but I simultaneously work with Sublime Text. However, I don't know how to create snippets in Sublime Text to python syntax, please help me to deal with it.

Upvotes: 0

Views: 293

Answers (1)

Abdulaziz0
Abdulaziz0

Reputation: 128

Creating snippets are as easy as VS Code. Just go to Tools -> Developer -> New Snippet

You can see xml file like this:

<snippet>
<content><![CDATA[
Hello, ${1:this} is a ${2:snippet}.
]]></content>
    <!-- Optional: Set a tabTrigger to define how to trigger the snippet -->
    <tabTrigger>hello</tabTrigger>
    <!-- Optional: Set a scope to limit where the snippet will trigger -->
    <scope>source.python</scope>
</snippet>
  1. Edit parameter of to be a main content and tabTrigger to a hint.
  2. You can also set a language in (python is deafult)
  3. Finally, save this in Sublime folder with .sublime-snippet extention.
  4. Enjoy )

Upvotes: 1

Related Questions