Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create my custom vim snippets?

I want to create some snippets when writting c++.
for example:
create a file, cpp.snippets.

priority -1
snippet exam
This is an example!
endsnippet

and put it in ~/.vim/my-snippets/snippets/.
then, add following statement in ~/.vimrc:

set runtimepath+=~/.vim/my-snippets/
let g:UltiSnipsSnippetsDir='~/.vim/my-snippets/'
let g:UltiSnipsSnippetDirectories=["snippets"]

But it not work, how can i fix it ?

like image 965
Kai7 Avatar asked Aug 22 '15 13:08

Kai7


1 Answers

If you are using the sirver/ultisnips plugin (UltiSnips) the correct way to do this is simply run the :UltiSnipsEdit command which opens up a custom snippets file for the current language / filetype.

like image 70
Skylar Brown Avatar answered Oct 13 '22 16:10

Skylar Brown