I have installed vim-snippets
and ultisnips
with plugin manager--pathogen
this way.
cd ~/.vim/bundle
sudo git clone https://github.com/honza/vim-snippets.git
cd ~/.vim/bundle && git clone git://github.com/SirVer/ultisnips.git
Set configuration in .vimrc
.
execute pathogen#infect()
execute pathogen#helptags()
syntax on
filetype plugin indent on
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsSnippetDirectories=['/home/debian9/.vim/UltiSnips']
I list if ife ifee
structure in my python.snippets.
cat .vim/bundle/vim-snippets/UltiSnips/python.snippets
snippet if "If" b
if ${1:condition}:
${2:${VISUAL:pass}}
endsnippet
snippet ife "If / Else" b
if ${1:condition}:
${2:${VISUAL:pass}}
else:
${3:pass}
endsnippet
snippet ifee "If / Elif / Else" b
if ${1:condition}:
${2:${VISUAL:pass}}
elif ${3:condition}:
${4:pass}
else:
${5:pass}
endsnippet
Now it is time to edit a test.py
file with vim.
Input #!
and press tab
can expand into :
#!/usr/bin/env python3
Input if
and press tab
can expand into :
if condition:
Why Input ifee
and press tab
can expand into nothing in my vim?
The file .vim/bundle/vim-snippets/UltiSnips/python.snippets
that you show is not included in the ultisnips directory you configured in your vimrc (/home/debian9/.vim/UltiSnips
).
You could try:
to change your configuration:
let g:UltiSnipsSnippetDirectories=['/home/debian9/.vim/bundle/vim-snippets/UltiSnips']
or alternatively, to check the file /home/debian9/.vim/UltiSnips/python.snippets
in order to see if the right snippets are defined.