vimneovimultisnips

vim ultisnips adds a delay when left-shifting in visual mode


I recently installed the ultisnips plugin on neovim, and I'm having an issue with it:

When I enable ultisnips, when I press < in visual mode, there's a delay until my lines are left-shifted, but my right-shifting using > works instantly.

If I run :verbose map <, I see the following

x  <nop>       * :call UltiSnips#SaveLastVisualSelection()<CR>gvs
        Last set from ~/.vim/plugged/ultisnips/autoload/UltiSnips/map_keys.vim line 64
s  <nop>       * <Esc>:call UltiSnips#ExpandSnippet()<CR>
        Last set from ~/.vim/plugged/ultisnips/autoload/UltiSnips/map_keys.vim line 62

And from what I see, the bindings are coming from the snippet files and they're not my mapping, so I was wondering if there's any way for me fix the issue.

Thank you


Solution

  • You have set g:UltiSnipExpandTrigger="<nop>".

    Line 62 of ultisnips/blob/master/autoload/UltiSnips/map_keys.vim:

    exec "snoremap <silent> " . g:UltiSnipsExpandTrigger . " <Esc>:call UltiSnips#ExpandTrigger()<cr>"
    

    You can see that this does not, in fact, disable a mapping for g:UltiSnipExpandTrigger. Instead, it maps the literal keys <nop> to <Esc>:call UltiSnips#ExpandTrigger()<cr>.

    Vim is waiting once you type < to see if you will then press nop>. After waiting a period of time, only then will it shift your selection left (how long depends on the value of 'timeoutlen').

    What you need to do is set g:UltiSnipExpandTrigger to a different key. If you want to disable it, you could map it to a function key between 13 and 19 (you probably don't have it on your keyboard):

    let g:UltiSnipExpandTrigger = "<F13>"