Sublime Forum

[solved] How to deactivate default snippet(s)

#1

Hi,

The default std::vector and std::map snippets for C++ have a fatal flaw for me.
The input
std::vec<tab>
expands to
std::std::vector<char> v;
which does not make sense.

I tried to follow the advice in this thread and override the default snippet with my own.

  1. Unzipped /opt/sublime_text_3/Packages/C++.sublime-package
  2. Copied extract/Snippets/std-vector-(v).sublime-snippet to ~/.config/sublime-text-3/Packages/User/
  3. Changed the contents to:
    `
    std::vector

`
4. Restarted Sublime Text

This changed nothing. Unfortunately, I am not a ST power user and I don’t really know how it loads its snippets, so this was mostly guesswork.

“Just don’t press Tab/Enter on the snippet” => I can’t help myself! ST’s tab-complete is so helpful with recurring words, I just expect it to complete “vector” for me.

Please point me to the docs on how to disable the snippet.

0 Likes

#2

I think the problem is that you copied it to the User Package folder, which means it won’t override the built in C++ package snippet. Also, removing the scope means it will operate in all circumstances, and removing the content means pressing Tab will never complete the word vector for you, it will always insert this blank snippet.

Better to install Package​Resource​Viewer via Package Control, and then:

  • Open the Command Palette
  • Type PRV: O
  • Select PackageResourceViewer: Open Resource
  • C++
  • Snippets
  • std-vector-(v).sublime-snippet
  • Change <scope>source.c++, source.objc++</scope> to <scope>non-existing-scope</scope> or indeed, delete the entire contents of the file
  • Save it
4 Likes

#3

So I installed a whole package to find out that the modified snipped needed to go in ~/.config/sublime-text-3/Packages/C++/ instead of ~/.config/sublime-text-3/Packages/User/.

Now it’s working great (not offering the snippet). Thank you so much! :slightly_smiling:

1 Like