-1

If I change the document type from "Plain Text" to other scope it works, but there is no scope limit for the snippet.

I tried "Sublime Text 3 snippet not working in plain text file with no extension" but had no luck.

In syntax-specific ("plain text") user settings I added this:

"extensions":
[
    "txt", ""
],
5
  • Are you saying you have a snippet that doesn't have a <scope> tag in it but it still doesn't work in plain text files? Commented Jun 17, 2019 at 13:10
  • what have you done so far? Please share an minimal (non) functional example to illustrate the issue. In which scope do you want to use the snippet? Commented Jun 17, 2019 at 15:20
  • @jack.sparrow All scope Commented Jun 17, 2019 at 15:53
  • 1
    You don't need to set extensions. set auto_complete_selector with no scope. I recreated the configuration on a pristine install and it is working for me. Commented Jun 17, 2019 at 17:07
  • Possible duplicate of create snippet for txt scope Commented Jun 17, 2019 at 17:08

1 Answer 1

1

When you create a snippet without specifying any scope it will be active for every file type:

<snippet>
    <content><![CDATA[
Hello, ${1:this} is a Sublime Text ${2:snippet} for all scopes.
]]></content>
    <tabTrigger>hello_all_scopes</tabTrigger>
</snippet>

To make the snippet visible as a popup on auto completion add the scope to the user preferences:

{
    "auto_complete_selector": "text"
}

Note that the key auto_complete_selector has a default setting that is overridden by the user key. You'll most likely want to add the default settings in your custom configuration. Scope selection can be further refined or other scopes added to the list, according to your requirements.

Sign up to request clarification or add additional context in comments.

3 Comments

The auto_complete_selector doesn't control when snippets are available, it only controls when the auto completion popup will automatically appear. In a completely stock portable install of Sublime, the snippet generated by Tools > Developer > New Snippet will appear as a snippet in the command palette in any file (even text) and will also automatically trigger if you add a trigger for it and type it followed by pressing Tab,regardless of the setting of auto_complete_selector.
Yes, that makes sense. I am so used to auto completion that I couldn't see it working even though it did. Thanks for the correction, I edited the answer.
I set auto_complete_selector with no scope to work for all scope.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.