Sublime Forum

TabTrigger for Snippets Won't work with a space?


When setting a tabtrigger in a New Snippet, everything works fine if the tabtrigger has no whitespace (I haven’t tried special characters but don’t need them right now), but if I include a space, it won’t work at all. Adding quotes, single or double, to either side, causes the trigger itself to require quotes, and doesn’t help me for what I need.

Below is what I’m trying to do. Obviously, I want to be able to tab-trigger the snippet when I type out “with open.” It works fine if I change the trigger to “with,” but that’s not helpful:

    <content><![CDATA[with open(infile, 'r', encoding='utf8', errors='ignore') as inf, \
        open(outfile, 'w', encoding='utf8', errors='ignore', newline='') as outf:
    <tabTrigger>with open</tabTrigger>


I believe that white space isn’t allowed in completion triggers (snippets, completion files, etc) because the check is done only on the word immediately to the left of the caret when you press tab. For the same reason, some word separator characters also don’t work in triggers.

1 Like