0

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.

1 Answer 1

1

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 )
Sign up to request clarification or add additional context in comments.

1 Comment

As an addendum to your answer, as an extra note you can also optionally add in a <description></description> pair to set a text description for what the snippet contains.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.