6

What is the correct way to change where UltiSnips searches for snippets. I tried this in my ~/.vimrc with no success:

let g:UltiSnipsSnippetsDir = "/newfolder/snippets/"
let g:UltiSnipsSnippetDirectories=["UltiSnipsNewDir"]
Mike Pennington
  • 41,899
  • 19
  • 136
  • 174
horatio1701d
  • 8,809
  • 14
  • 48
  • 77

2 Answers2

5

first one just use the full path like ex:

let g:UltiSnipsSnippetsDir = "~/.vim/bundle/ultisnips/UltiSnips"
  • thank you. in the end decided to not mess around with the directory configuration and just have automated backups of my snippets from default directory into location I want. I was just concerned about location where I am backing things up from. – horatio1701d Aug 12 '15 at 15:47
  • `let g:UltiSnipsSnippetsDir = "~/.vim/bundle/ultisnips/UltiSnips"` should be added to your `~/.vimrc` file. – thedanotto Sep 29 '16 at 14:54
0

This works for me:

First add this line to .vimrc file:

leg g:UltiSnipsSnippetDirectories=["FolderA","FolderB"]

Then put your snips under folder:

~/vim/bundle/vim-snippets/FolderA

Notice: the middle path should be "vim-snippets" not "ultisnips" if relative path is used, because the snippets are separated from the engine, it's another plugin 'honza/vim-snippets'.

BTW, UltiSnipsSnippetDirectories is where ultisnips searchs snips, UltiSnipsSnippetsDir is where to save snips when you type :UltiSnipsEdit to create a snip.

Hine
  • 1
  • 1