Shougo / neosnippet.vim

neo-snippet plugin
Other
1.12k stars 108 forks source link

Minimal vimrc (and/or nvim), cannot expand snippets #459

Closed paulreimer closed 5 years ago

paulreimer commented 5 years ago

Using minimal vimrc like below, I still cannot get snippets to expand. Have tried neovim 0.4.0, vim 8.1, vim8.0 -- all on latest macOS / Terminal.app.

First I tried only neosnippets plugin, but then added neocomplete (normally I use deoplete, but just keeping it simple) Anyway, minimal rc still not working for me.

Observed behaviour:

  1. Type e.g. calloc in foo.c (if neocomplete is enabled, then I can see it shows in popup).
  2. Attempt expansion, either using ctrl-k or "supertab"-like: a. Still in insert mode, use recommended bindings == ctrl-k to expand b. Or, using "supertab" behaviour with neocomplete snippet highlighted, try using Tab.
  3. NO text is expanded. Just keep hitting ctrl-k (or Tab), nothing happens.

I know it has loaded the snippet files for *.c files, because it shows up in the popup menu. And if I type a valid snippet in insert mode, then I CANNOT use the Tab button afterwards. So I think something is wrong with the expansion, because it knows that my text is "expandable" but cannot do the expand.

Can anyone suggest something to try? Or where to get debug info on what happens during expansion?

call plug#begin()

Plug 'Shougo/neocomplete.vim'
Plug 'Shougo/neosnippet-snippets'
Plug 'Shougo/neosnippet.vim'

call plug#end()

let g:neocomplete#enable_at_startup = 1

imap <C-k> <Plug>(neosnippet_expand_or_jump)
smap <C-k> <Plug>(neosnippet_expand_or_jump)
xmap <C-k> <Plug>(neosnippet_expand_target)

" SuperTab like snippets behavior.
imap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: pumvisible() ? "\<C-n>" : "\<TAB>"
smap <expr><TAB> neosnippet#expandable_or_jumpable() ?
\ "\<Plug>(neosnippet_expand_or_jump)"
\: "\<TAB>"

filetype plugin indent on
syntax enable
e-kwsm commented 5 years ago

a3c618221999a64997d32563fc6bdabdb63e898d seems to cause the situation.

paulreimer commented 5 years ago

Oh, so this is maybe a new issue? I was very excited about this language-server-protocol issue being resolved with neosnippet, with the previous commit f29b82e

paulreimer commented 5 years ago

FYI, I pinned a fork at the previous commit f29b82e, and it resolved my issue (expansion works).

Shougo commented 5 years ago

I have fixed it.

paulreimer commented 5 years ago

Yup, works now. Thanks @Shougo !