Sublime Forum

Is it possible to limit snippet to particular file

#1

Hi, when creating a snipped I understand how to limit the completion suggestions to only display in a particular file/ syntax type. However, I have some snippets which will only ever be useful in a single file, not all files of that type. Is it possible to limit it to only one file e.g. “I only want this snipped to be suggested in xyz.sh”?

0 Likes

#2

By default, no; snippets are either available in all files or only specific scopes. So, to have them apply in a specific file the scope would need to be unique, which is likely more trouble than it is worth to do.

However, I have a package I’m working on called EnhancedSnippets which allows you to create a snippet that includes a glob that must match the file in order to consider the snippet.

You may find that useful.

0 Likes

#3

OK, that’s what I thought from reading the documentation. No big deal. Thanks for the answer! I will check out enhancedsnippets

0 Likes