Search code examples
vimneovimyoucompletemeultisnips

Why UltiSnips does not recognize my own snippets?


Currently I use YouCompleteMe in Vim, then I have installed UltiSnips and vim-snippets with vundler. UltiSnips and YouCompleteMe are compatible and work properly; however, the problem comes when I define my own snippet because these are not recognized.

I suspect that the problem comes when I use the UltiSnipsEdit function because it creates the UltiSnips folder in my home directory and not inside the .vim folder. For example, when I am working with R scripts and I use UltiSnipsEdit, it creates the r.snippets file inside /home/UltiSnips. Then I define a snippet just to test:

snippet test "Testing snip for R." 
# snipp is working
endsnippet

After saving the file, the snippet does not apper on the list of YouCompleteMe nor is expanded with :UltiSnipsExpandTrigger (<c-l> in my case).


Solution

  • Adding let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/UltiSnips'] to the .vimrc file makes it works.