Shougo / neosnippet.vim

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

Neovim exits insert mode if a snippet has no placeholders #465

Closed e-kwsm closed 5 years ago

e-kwsm commented 5 years ago

Problems summary

As of 4903cf61966f824b4e603780c9e3871b28f77ba9, nvim exits insert mode when calling neosnippet_expand_or_jump on a snippet without placeholders. Is it possible to behave as beforehand if a snippet has no placeholders?

Expected

When calling neosnippet_expand_or_jump on a snippet without placeholders, cursor jumps to the end of the expanded one and stay in insert mode.

Environment Information

minimal init.vim/vimrc

set runtimepath+=/tmp/neosnippet.vim
imap <C-k>     <Plug>(neosnippet_expand_or_jump)
let g:neosnippet#snippets_directory='/tmp/snippets'

How to reproduce the problem from neovim/Vim startup

$ cd /tmp
$ git clone --depth 1 https://github.com/Shougo/neosnippet.vim
$ mkdir snippets
$ cat << EOF > snippets/_.snip
snippet lorem
    Lorem ipsum dolor sit amet
EOF

Then nvim -u vimrc and ilorem<C-k>.

e-kwsm commented 5 years ago

Thanks.

e-kwsm commented 5 years ago

@Shougo Unfortunately that is insufficient: when expanding a snippet that is not located at the end (e.g. lorem in lorem blah blah), cursor jumps to the end of line.

The commits affected snippets that assumes implicit ${0} at ends; I will create PR to fix some of them.

Shougo commented 5 years ago

I have fixed it. Please update neosnippet.