How to add new snippets to snipMate in VIM

Omnipresent picture Omnipresent · Aug 15, 2011 · Viewed 7.3k times · Source

Ive just started using the sniptMate plugin for VIM and love it, however, since my collection of snippets isn't huge, I'd like to be able to add new snippets dynamically rather than opening the snippets file and creating a new snippet as I am in the middle of development.

As I am coding something I realize that some specific piece of code can be saved as a snippet to save me trouble of typing the bloat code again, at this time I want to be able to add a snippet without opening the snippet file for the language I am using at the time.

Answer

vikred picture vikred · Sep 24, 2012

If you are using pathogen, you can write your own snippets without polluting the original ones. To do this, add your snippets to ~/.vim/bundle/mysnippets/snippets/*.snippets. FYI, mysnippets can be any name.

Moreover, it's a convention to add a _.snippets file in that directory where you add snippets which should be available everywhere irrespective of the filetype.