Closed yorickpeterse closed 4 years ago
Sorry. This is feature of deoplete. deoplete need to disable the first entry select, because deoplete is asynchronous plugin.
set completeopt=menuone,noinsert
It may be better.
If you don't like the behavior, you should use other auto completion plugin. No magic.
@Shougo That's unfortunate. It might be worth mentioning that somewhere in the documentation, that way it's more clear for people running into this in the future.
OK. I have updated the documentation.
@Shougo ncm2 seems to have a similar issue, but provides a workaround/fix for this. Per https://github.com/ncm2/ncm2#install, you basically add this:
autocmd User Ncm2PopupOpen set completeopt=noinsert,menuone,noselect
autocmd User Ncm2PopupClose set completeopt=menu
I tested this and at least for ncm2 it fixes the issue. If Deoplete had a similar autocmd it invokes, that could be used as a workaround. Would adding that be a possibility?
OK. I have implemented completeopt
restore on CompleteDone
.
Please test deoplete latest version.
I have reverted the change unfortunately.
If I restore completeopt
when CompleteDone
, it breaks auto completion behavior.
Some workaround exists.
call deoplete#handler#_skip_next_completion()
before <C-p>
InsertLeave
before <C-p>
@Shougo Thanks for taking a look at this. I'll take a look at your last two suggestions to see if I can adopt that. Thanks again!
Example:
inoremap <expr><C-p> pumvisible() ? "\<C-p>" : "\<C-o>:call deoplete#handler#_skip_next_completion()\<CR>\<C-p>"
Problems summary
I use both Deoplete and keyword completions (using C-n and C-p). When deoplete displays one or more results in a popup (but I don't select any), using C-n for completion requires pressing it twice to make a selection. Take this Python file for example:
Here the
|
indicates where the cursor is. If Deoplete is enabled (and buffer completions are enabled) and I type "Fo", deoplete will show me 4 results. So far so good.Now say that I dismiss these entries by deleting the "o", we end up with this:
If I now press C-n, Vim will show me 3 entries but not select any of them:
To make the first selection, I have to press C-n again. This does not happen when Deoplete has no completions to show (e.g. it's disabled entirely, or all sources available have been disabled).
This can be seen in the following recording:
Expected
Pressing C-n will always select the first entry, with or without Deoplete
Environment Information
deoplete version (SHA1): 7ab4c1bde7f9bd8824219594b07e4c1aa0814d4e
OS: Arch Linux,
Linux roach 5.8.2-arch1-1 #1 SMP PREEMPT Thu, 20 Aug 2020 20:45:00 +0000 x86_64 GNU/Linux
neovim/Vim
:version
output:version output
``` NVIM v0.4.4 Build type: Release LuaJIT 2.0.5 Compilation: /usr/bin/cc -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.4/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include Compiled by builduser Features: +acl +iconv +tui See ":help feature-compile" system vimrc file: "$VIM/sysinit.vim" fall-back for $VIM: "/usr/share/nvim" Run :checkhealth for more info ```:checkhealth
or:CheckHealth
result(neovim only):CheckHealth output
``` health#deoplete#check ======================================================================== ## deoplete.nvim - OK: exists("v:t_list") was successful - OK: has("timers") was successful - OK: has("python3") was successful - OK: Require Python 3.6.1+ was successful - OK: Require msgpack 1.0.0+ was successful - INFO: If you're still having problems, try the following commands: - $ export NVIM_PYTHON_LOG_FILE=/tmp/log - $ export NVIM_PYTHON_LOG_LEVEL=DEBUG - $ nvim - $ cat /tmp/log_{PID} - and then create an issue on github health#nvim#check ======================================================================== ## Configuration - OK: no issues found ## Performance - OK: Build type: Release LuaJIT ## Remote Plugins - OK: Up to date ## terminal - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~ - INFO: $VTE_VERSION='6003' - INFO: $COLORTERM='truecolor' health#provider#check ======================================================================== ## Clipboard (optional) - OK: Clipboard tool found: xclip ## Python 2 provider (optional) - INFO: Using: g:python_host_prog = "/usr/bin/python2" - INFO: Executable: /usr/bin/python2 - ERROR: Command error (job=11, exit code 1): `'/usr/bin/python2' -c 'import sys; sys.path.remove(""); import neovim; print(neovim.__file__)'` (in '/home/yorickpeterse/Projects/general/dotfiles/dotfiles/.config/nvim/plugged/deoplete.nvim') Output: Traceback (most recent call last): File "Provide a minimal init.vim/vimrc with less than 50 lines (Required!)
Save this file in
/tmp/test.vim
.How to reproduce the problem from neovim/Vim startup (Required!)
Create
/tmp/example.py
with the following content:Save this file, then start nvim as follows:
Move the cursor to the end of
number =
, and type "Fo". Deoplete will perform buffer completion. Now delete the "o" so the popup goes away. Now press C-n, and notice how the first entry is not selected.Next, stop NeoVim and edit
/tmp/test.vim
to look as follows:This will disable buffer completion. Now start NeoVim the same way as before, and again move the cursor to the end of the
number =
line. Type "F" and press C-n to trigger keyword completion. Note that the first entry is selected.This problem happens consistently: whenever Deoplete has candidates to show, I have to press C-n twice to trigger keyword completion and select the first result.
Generate a logfile if appropriate
log.txt