Ultisnips: NeoVim + UltiSnips don't work well

Created on 14 Apr 2018  路  4Comments  路  Source: SirVer/ultisnips

Steps to reproduce

  1. I wasn't able to build a minimalistic example of the issue, but here's my vimrc. Basically, install ultisnips, although I'm not sure anything else isn't interfering.

first vimrc -- it uses Deoplete and actually misses few lines from the default config suggestions (like mapping <tab> to expand key), one might simply add few these lines, but it works even without those.
second vimrc -- this one doesn't have Deoplete at all, like described below.

  1. nvim file.cpp
  2. Try to expand a snippet. E.g. ans<tab>

My ~/.vim/UltiSnips/cpp.snippets content is:

snippet ans "anonymous namespace"
namespace {
  ${VISUAL}$0
} // namespace
endsnippet

Hence, I expect the macro to expand. In fact, nothing happens.

  1. Try vim file.cpp and do the same: ans<tab> -> The snippet expands!

Okay, that's weird. I first blamed it on Deoplete, but in fact even completely removing Deoplete and everything related and/or remapping snippet expansion key to e.g. <Up> or anything else does not change anything.

  1. One more strange thing: install honza/vim-snippets. After that, the expansion works (using the same <tab> key, i.e. the only change from the config I posted is basically installed honza/vim-snippets). Not only the snippets brought by the plugin work, but my snippets (e.g. ans) work aswell.

All in all, I would very much like to have UltiSnips working without having to install honza/vim-snippets, because I don't really need it and I like calling my snippets using similar or same names.


  • Operating System: Arch Linux
  • Vim Version: NeoVim v0.2.2, Vim 8.0 (Included patches: 1-1542)
  • UltiSnips Version: HEAD: 64a023a7ec28d85a00badcaa9abe7490563597ed
  • Python inside Vim:
3.6.4 (default, Jan  5 2018, 02:35:40)
[GCC 7.2.1 20171224]
neovim only possible bug

Most helpful comment

Neovim is currently not supported. However I'm using neovim with ultisnips, and it works for me without vim-snippets. I'm not seeing configured path to search snippets in your vimrc files. You saying that your snippet located in ~/.vim/UltiSnips/cpp.snippets. Try to add let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/UltiSnips'] to your vimrc, and try again.

All 4 comments

Neovim is currently not supported. However I'm using neovim with ultisnips, and it works for me without vim-snippets. I'm not seeing configured path to search snippets in your vimrc files. You saying that your snippet located in ~/.vim/UltiSnips/cpp.snippets. Try to add let g:UltiSnipsSnippetDirectories=[$HOME.'/.vim/UltiSnips'] to your vimrc, and try again.

Have you've done this? https://neovim.io/doc/user/nvim.html#nvim-from-vim. my guess is your Snippets are not found because they are not on the search path for NeoVim. Closing as this is quite definitley a neovim config issue, not an UltiSnips issue.

Hi, I had the same problem, and tried @andreyorst then fixed. Thanks!

If you only use your own snippets, the answer by @andreyorst may be ok. But if you also use vim-snippets, you will find that a lot of snippets becomes inactive.

For example, if you create a markdown.snippets under that directory and add the following snippet:

snippet kbd "keyboard tag"
<kbd>${1:KEY}</kbd>$0
endsnippet

Open a markdown file and the kbd snippet is available. But many snippets provided here for markdown file by vim-snippets are invalid now.

If this is not what you want, you may consider the answer here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blackode picture blackode  路  5Comments

Industrial picture Industrial  路  8Comments

LinArcX picture LinArcX  路  3Comments

ghost picture ghost  路  8Comments

codybuell picture codybuell  路  4Comments