0

Maybe it's a stupid question, but I can't figure it out. I have installed the UltiSnips plugin. I followed all the instructions on setting it up. I added this into my .vimrc file but it's not working:

" Track the engine.
Plugin 'SirVer/ultisnips'

" Snippets are separated from the engine. Add this if you want them:
Plugin 'honza/vim-snippets'

" Trigger configuration. Do not use <tab> if you use https://github.com/Valloric/YouCompleteMe.
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<c-b>"
let g:UltiSnipsJumpBackwardTrigger="<c-z>"

I checked that Tab is not used anywhere in the rest of my .vimrc file. When I type cl and press Tab nothing happens. However, I am expecting it to offer me insert snippet for the python class.

This is the list of plugin I am using:

ctrlp
jedi-vim
SumpylFold
ultisnips
vim-airline
vim-airline-themes
vim-fugitive
Vundle
indentpython
nerdtree
vim-nerdtree-tabs
syntastic
vim-flake8

What am I missing here? Can anyone help me?

1 Answer 1

4

This is because of this line in UtliSnips documentation:

UltiSnips comes without snippets. The default snippets can be found here: https://github.com/honza/vim-snippets

UltiSnips is just an engine, you need to install/create own snippets. I use those recommended vim-snippets and they work like a charm.

4
  • thanks for the answer. I thought it would work out of the box ))).
    – Nurjan
    Commented Apr 20, 2017 at 7:03
  • Do you know how to add snippets from vim-snippets into UltiSnips? There is no clear information about that. I also assumed according to the installation instructions that UltiSnips will use the snippets from vim-snippets directory in ~/.vim/bundle.
    – Nurjan
    Commented Apr 20, 2017 at 8:46
  • It should use them. I use pathogen and only thing I did was to clone vim-snippets to ~/.vim/bundle. According to UltiSnips documentation: UltiSnips will search each 'runtimepath' directory for the subdirectory names defined in g:UltiSnipsSnippetDirectories in the order they are defined. So check if vim-snippets and UltiSnips are in the output of :scriptnames and/or :set rtp?
    – grodzik
    Commented Apr 20, 2017 at 8:55
  • 1
    I added this line from the documentation of UltiSnips let g:UltiSnipsSnippetDirectories=["UltiSnips"] to the .vimrc file and it's working fine now. It wasn't obvious in my case, though.
    – Nurjan
    Commented Apr 20, 2017 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.