antoinemadec / coc-fzf

fzf :heart: coc.nvim
388 stars 28 forks source link

Editor enters insert mode when using `CocFzfList` and the options chosen lead to opening a file. #84

Closed AlaaSaadAbdo closed 3 years ago

AlaaSaadAbdo commented 3 years ago

Environment

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

health#floaterm#check

health#coc#check

health#coc_fzf#check

ctags (optional)

fzf.vim (optional)

health#nvim#check

Configuration

Performance

Remote Plugins

terminal

health#provider#check

Clipboard (optional)

Python 2 provider (optional)

Python 3 provider (optional)

Ruby provider (optional)

Node.js provider (optional)


# 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

  1. nvim -u minimal_vimrc
  2. run :CocFzfList
  3. Choosing files option
  4. 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.

antoinemadec commented 3 years ago

@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.