Ultisnips: Ultisnips not working

Created on 18 Jul 2015  路  6Comments  路  Source: SirVer/ultisnips

I just bought an XPS13 DE with Ubuntu 14.04 preinstalled. I loaded up my vim configuration, but suddenly I was having trouble. I am unable to get the snippets to neither list nor expand.

I've strip the system as much as I can to isolate the problem.
I've only only got Pathogen, ultisnips and a test-snip installed.

Here is where I am.

The snips file all.snippets (which I've strip down from Honza) loads fine when I run :UltiSnipsEdit only have the following content:

priority -60

snippet lorem "Lorem Ipsum - 50 Words" b
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren,
no sea takimata sanctus est Lorem ipsum dolor sit amet.
endsnippet

# vim:ft=snippets:

The shortcut is load as far as I can see:

:verbose map <tab>
x  <Tab>       * :call UltiSnips#SaveLastVisualSelection()<CR>gvs
        Last set from ~/.vim/bundle/ultisnips/autoload/UltiSnips/map_keys.vim
s  <Tab>       * <Esc>:call UltiSnips#ListSnippets()<CR>
        Last set from ~/.vim/bundle/ultisnips/autoload/UltiSnips/map_keys.vim

My .vimrc after stripping it down:

set nocompatible
filetype plugin indent on
filetype plugin on

augroup Pathogen
    autocmd!
    execute pathogen#infect()
    Helptags
augroup end

let g:UltiSnipsExpandTrigger='<tab>'
let g:UltiSnipsListSnippets='<tab>'
let g:UltiSnipsJumpForwardTrigger='<c-j>'
let g:UltiSnipsJumpBackwardTrigger='<c-k>'
let g:UltiSnipsSnippetsDir="~/.vim/ultisnips"

I updated my vim to the newest version:

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 26 2015 15:08:24)
Included patches: 1-683
Modified by [email protected]
Compiled by buildd@
Huge version with GTK2-GNOME GUI.  Features included (+) or not (-):
+acl             +cmdline_info    +emacs_tags      -hangul_input    +menu            +mouse_xterm     -python3         +syntax          +virtualedit     +xsmp_interact
+arabic          +comments        +eval            +iconv           +mksession       +multi_byte      +quickfix        +tag_binary      +visual          +xterm_clipboard
+autocmd         +conceal         +ex_extra        +insert_expand   +modify_fname    +multi_lang      +reltime         +tag_old_static  +visualextra     -xterm_save
+balloon_eval    +cryptv          +extra_search    +jumplist        +mouse           -mzscheme        +rightleft       -tag_any_white   +viminfo         +xpm
+browse          +cscope          +farsi           +keymap          +mouseshape      +netbeans_intg   +ruby            +tcl             +vreplace
++builtin_terms  +cursorbind      +file_in_path    +langmap         +mouse_dec       +path_extra      +scrollbind      +terminfo        +wildignore
+byte_offset     +cursorshape     +find_in_path    +libcall         +mouse_gpm       +perl            +signs           +termresponse    +wildmenu
+cindent         +dialog_con_gui  +float           +linebreak       -mouse_jsbterm   +persistent_undo +smartindent     +textobjects     +windows
+clientserver    +diff            +folding         +lispindent      +mouse_netterm   +postscript      -sniff           +title           +writebackup
+clipboard       +digraphs        -footer          +listcmds        +mouse_sgr       +printer         +startuptime     +toolbar         +X11
+cmdline_compl   +dnd             +fork()          +localmap        -mouse_sysmouse  +profile         +statusline      +user_commands   -xfontset
+cmdline_hist    -ebcdic          +gettext         +lua             +mouse_urxvt     +python          -sun_workshop    +vertsplit       +xim
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
  2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/in
clude/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu
/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz   -pthread -DORBIT2=1 -D_REENTRANT -I/usr/include/libgnomeui-2.0 -I/usr/include/li
bart-2.0 -I/usr/include/gconf/2 -I/usr/include/gnome-keyring-1 -I/usr/include/libgnome-2.0 -I/usr/include/libbonoboui-2.0 -I/usr/include/libgnomecanvas-2.0 -I/usr/include/g
tk-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gnome-vfs-2.0 -I/usr/lib/x86_64-linux-gnu/gnome-vfs-2.0/include -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus
-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/orbit-2.0 -I/usr/include/libbonobo-2.0 -I/usr/include/bonobo-activation-2.0
 -I/usr/include/libxml2 -I/usr/include/pango-1.0 -I/usr/include/gail-1.0 -I/usr/include/harfbuzz -I/usr/include/freetype2 -I/usr/include/atk-1.0 -I/usr/lib/x86_64-linux-gnu
/gtk-2.0/include -I/usr/include/cairo -I/usr/include/gio-unix-2.0/ -I/usr/include/pixman-1 -I/usr/include/libpng12     -g -O2 -fPIE -fstack-protector --param=ssp-buffer-siz
e=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/usr/include/tcl8.6  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE
 -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0
-lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype     -lgnomeui-2 -lSM -lICE -lbonoboui-2 -lgnomevfs-2 -lgnomecanvas-2 -lgnome-2 -lpopt -lbonobo-2 -lbonobo-activation -lORBi
t-2 -lart_lgpl_2 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lfreetype -lgconf-2 -lgt
hread-2.0 -lgmodule-2.0 -lgobject-2.0 -lglib-2.0   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.
2 -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/lib/perl/5.18/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread
 -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions  -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-1.9.1 -lpthread -lrt -
ldl -lcrypt -lm  -L/usr/lib

I feel I've missed something obvious here. Any idea on what is going on?

user question

Most helpful comment

Sorry, I missed something in the vimrc. The g:UltiSnipsSnippetsDir is wrong. Remove the line and mv ~/.vim/ultisnips ~/.vim/UltiSnips and you should be golden.

All 6 comments

I have two ideas here:

1) first check verbose imap <tab>. That is what actually triggers expands.

2) pathogen infect must be called before you enable plugins.

From the pathogen readme:

execute pathogen#infect()
syntax on
filetype plugin indent on

It is likely one of these issues. Closing - if you have more problem I will reopen.

1) verbose imap <tab> gives me:

i  <Tab>       * <C-R>=UltiSnips#ListSnippets()<CR>
        Last set from ~/.vim/bundle/ultisnips/autoload/UltiSnips/map_keys.vim

2) Moving pathogen#infect() to before filetype made no difference. Neither did adding syntax on.

1) that seems wrong - it should be UltiSnips#ExpandSnippet - you cannot have the same trigger for expanding and listing. That is probably the issue.

2) please post your full vimrc or put it on github whenever you make changes. It is hard to guess diffs by prose only.

Okay.

My current .vimrc is:

set nocompatible

execute pathogen#infect()
syntax on
filetype plugin indent on

let g:UltiSnipsExpandTrigger='<tab>'
let g:UltiSnipsListSnippets='<s-tab>'
let g:UltiSnipsJumpForwardTrigger='<c-j>'
let g:UltiSnipsJumpBackwardTrigger='<c-k>'
let g:UltiSnipsSnippetsDir="~/.vim/ultisnips"

The resulting from doing verbose imap:

i  <S-Tab>     * <C-R>=UltiSnips#ListSnippets()<CR>
        Last set from ~/.vim/bundle/ultisnips/autoload/UltiSnips/map_keys.vim
i  <Tab>       * <C-R>=UltiSnips#ExpandSnippet()<CR>
        Last set from ~/.vim/bundle/ultisnips/autoload/UltiSnips/map_keys.vim

Unfortunately, still not able to expand the snippet.

Thanks for taking the time to look at my problem.

Sorry, I missed something in the vimrc. The g:UltiSnipsSnippetsDir is wrong. Remove the line and mv ~/.vim/ultisnips ~/.vim/UltiSnips and you should be golden.

Thanks mate, that did the trick!

Was this page helpful?
0 / 5 - 0 ratings