Editor enters insert mode when using `CocFzfList` and the options chosen lead to opening a file.
AlaaSaadAbdo opened this issue · comments
Environment
echo $FZF_DEFAULT_OPTS
: "none"bat --version
: bat 0.16.0- Are your vim plugins up-to-date?: yes
(n)vim --version
: NVIM v0.4.4
(n)vim --version output
NVIM v0.4.4
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -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=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp/neovim-20200808-17465-1c37yvx/neovim-0.4.4/build/config -I/tmp/neovim-20200808-17465-1c37yvx/neovim-0.4.4/src -I/usr/local/include -I/tmp/neovim-20200808-17465-1c37yvx/neovim-0.4.4/deps-build/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20200808-17465-1c37yvx/neovim-0.4.4/build/src/nvim/auto -I/tmp/neovim-20200808-17465-1c37yvx/neovim-0.4.4/build/include
Compiled by brew@Mojave
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.4.4/share/nvim"
Run :checkhealth for more info
health#mkdp#check
========================================================================
- INFO: Platform: macos
- INFO: Nvim Version: NVIM v0.4.4
- INFO: Node version: v12.4.0
- INFO: Script: /Users/amansour/.config/nvim/plugged/markdown-preview.nvim/app/server.js
- INFO: Script exists: 1
- OK: Using node
health#floaterm#check
========================================================================
- OK: Terminal feature is OK
- OK: Floating window feature is OK
- OK: nvr is OK
health#coc#check
========================================================================
- OK: Environment check passed
- OK: Javascript bundle build/index.js found
- OK: Service started
health#coc_fzf#check
========================================================================
## ctags (optional)
- OK: ctag found
## fzf.vim (optional)
- OK: fzf.vim found
health#nvim#check
========================================================================
## Configuration
- OK: no issues found
## Performance
- OK: Build type: Release
## Remote Plugins
- OK: Up to date
## terminal
- INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
- INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
- INFO: $COLORTERM='truecolor'
health#provider#check
========================================================================
## Clipboard (optional)
- OK: Clipboard tool found: pbcopy
## Python 2 provider (optional)
- INFO: Using: g:python_host_prog = "/usr/bin/python"
- INFO: Executable: /usr/bin/python
- INFO: Python version: 2.7.16
- INFO: pynvim version: 0.4.1 (outdated; from /Library/Python/2.7/site-packages/neovim)
- WARNING: Latest pynvim is NOT installed: 0.4.2
## Python 3 provider (optional)
- INFO: Using: g:python3_host_prog = "/usr/local/bin/python3"
- INFO: Executable: /usr/local/bin/python3
- INFO: Python version: 3.8.6
- INFO: pynvim version: 0.4.1 (outdated; from /usr/local/lib/python3.8/site-packages/neovim)
- WARNING: Latest pynvim is NOT installed: 0.4.2
## Ruby provider (optional)
- INFO: Ruby: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
- INFO: Host: /usr/local/bin/neovim-ruby-host
- OK: Latest "neovim" gem is installed: 0.8.1
## Node.js provider (optional)
- INFO: Node.js: v12.4.0
- INFO: Neovim node.js host: /Users/amansour/.config/yarn/global//node_modules/neovim/bin/cli.js
- OK: Latest "neovim" npm/yarn package is installed: 4.9.0
Describe the Bug
When choosing a file to open from the files in the coc-fzf files menu, the correct file is opened but the editor is in insert mode. This only happens when doing the following:
1. CocFzfList
2. Choosing files option
3. Choosing a file to open
This is not the same behaviour when use the following command directly: :CocFzfList files
This is not the same behavior when using CocList
when using CocList
the file is open and the editor is in normal mode.
To Reproduce
Minimal vimrc
" minimal vimrc
call plug#begin()
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'neoclide/coc.nvim', {'do': 'yarn install --frozen-lockfile'}
Plug 'antoinemadec/coc-fzf'
call plug#end()
Steps to Reproduce
- nvim -u minimal_vimrc
- run
:CocFzfList
- Choosing files option
- Choosing a file to open
# Expected Behavior
The editor should stay in Normal mode when openning a file
Note:
This also happens when choosing an outline or a symbol or any option in `CocFzfList` that leads you to opening a file.
I'm not 100% sure if this is a bug, but the behaviour is inconsistent.
Last but not least, thanks for the wonderful plugin.
@AlaaSaadAbdo thanks for reporting this issue.
This comes from a bug in neovim related to the terminal which is needed to display the lists.
There is a workaround that I implemented in this plugin, but it is not perfect.
Thankfully this is fixed in newer versions of neovim. Just upgrade neovim to version >= 0.5.0 to fix this issue.