-
-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enter should close popupmenu and enter a line break (default / completeopt+=noselect) #492
Comments
This is Vim's feature. I cannot fix it. I think Vim/neovim cannot change the behavior. |
I don't understand. Please describe the reproduce ways like this.
Please add more detailed information. |
I don't understand it. |
With this set rtp+=~/.vim/plugged/deoplete.nvim
call deoplete#enable()
set cmdheight=2
set shortmess+=c
norm! ifoo.bar
norm! ofoo.baz
norm! ofoo OK (closes popup and goes to line 4)
NOT OK (closes popup, but stays in line 4)
If you You can see (especially with When pressing |
btw: what do you think about having tests for those nasty issues? |
To add the tests is better. |
It is not expected behavior. Not OK. |
I have checked the behavior.
This is Vim/neovim feature. Closing. |
narrowing pattern.
noselect pattern. The completion window is re-generated by deoplete.
no completion window pattern |
|
I don't want to change the |
Why not use a mapping to workaround this on your own? inoremap <expr> <CR> (pumvisible() ? "\<c-y>\<cr>" : "\<CR>") |
It means deoplete should change Because, it is easy to conflict with other plugins and other configurations. |
There is never a currently selected match.. it uses But it indeed happens with Neovim itself, when using Using I think deoplete could detect this, since it gets a word in
It could look for empty The behavior seems to get triggered by narrowing down the selection, and using |
A workaround is to use |
Something to play with maybe?! diff --git i/autoload/deoplete/handler.vim w/autoload/deoplete/handler.vim
index 925ca9b..edac4bf 100644
--- i/autoload/deoplete/handler.vim
+++ w/autoload/deoplete/handler.vim
@@ -22,6 +22,7 @@ function! deoplete#handler#_init() abort
if g:deoplete#enable_refresh_always
autocmd deoplete InsertCharPre * call s:completion_begin('InsertCharPre')
endif
+ autocmd deoplete InsertCharPre * let s:last_insertchar = pumvisible() ? v:char : 0
call s:on_event('Init')
endfunction
@@ -207,6 +208,10 @@ function! s:complete_done() abort
endif
endif
+ if !empty(v:completed_item) && empty(v:completed_item.abbr) && v:char == 29
+ call feedkeys("\<cr>")
+ endif
+
if !g:deoplete#enable_refresh_always
call deoplete#handler#_skip_next_completion()
endif |
This is ugly hack. I don't want to change it. |
Yes. |
Why? |
Because, I don't learn other DSL for testing. |
I think the Vim/NeoVim docs (
This makes sense, because otherwise the menu is very obtrusive/annoying. If I don't need the suggestion, ex. ending a line of Ruby with It only makes sense to steal Yes, there are workarounds, but so far they've broken at least lexima.vim (a plugin that auto-closes braces, including moving your cursor to the correct spot after auto-closing followed by |
Really??? |
deoplete can map |
And please describe the conflict with lexima behavior with minimal vimrc with reproduce instruction. |
It seems workaround exists. |
I don't want to steal |
It is this. |
I think user should choose the behavior using |
I'm sorry, my apologies, the issues is entirely lexima.vim's fault. Based on the answers in these tickets, I thought it was an unresolved deoplete issue based on a misreading of the documentation. I read the response to this ticket as "not going to fix it" but I think the answer is it does work this way. With a fresh config that doesn't include lexima.vim, deoplete works as expected with respect to newline behavior. Sorry again. |
OK. I get it. |
Thank you @woahdae for pointing this out! I recently switched over to lexima as well and I could never find out why the popup menu selection with would always insert a new line. It was driving me crazy! Thank you for including the note in your FAQ @Shougo ! That is the ONLY I eventually discovered the issue. |
vimrc:
Typing
b
afterfoo.
will offerbar
andbaz
(with "[M]") hint.Pressing Enter then will close the popup menu, and the cursor will stay there.
But since by default
completeopt+=noinsert
gets used (and not 'noselect'), the cursor should move to the next line.After typing
ba
followed by<Backspace>
<Enter>
will close the popup (leaving "foo.b"), and jump to the next line (as expected).It seems like
'noselect'
gets used by default, but if the user had'noinsert'
already, thenEnter
should probably select the first entry when pressing Enter?! (and this seems to work as expected)It seems to be related to what eeda83b does, since that fixed an intermediate problem, where the popup would need two Enter presses before being closed even.
I am using Neovim master, let me know if you need more information, and/or cannot reproduce it.
The text was updated successfully, but these errors were encountered: