fzf icon indicating copy to clipboard operation
fzf copied to clipboard

[neovim] :FZF sometimes fails to open certain files

Open adambiggs opened this issue 11 years ago • 48 comments

Sometimes when I :FZF, select a file, and then press <Enter>, NeoVim becomes unresponsive.

When this happens, pressing <Enter> a couple more times brings up the following:

W10: Warning: Changing a readonly file
E315: ml_get: invalid lnum: 570
Press ENTER or type command to continue
E315: ml_get: invalid lnum: 568
Press ENTER or type command to continue
E315: ml_get: invalid lnum: 403
Press ENTER or type command to continue
...

Interestingly, opening the same file in a split (via <C-v>) seems to work, although nothing happens until I press <Enter> one extra time... i.e. <C-v> nothing happens <Enter> buffer opens as expected.

Quitting & relaunching NeoVim seems to make the problem go away for a while, so it's difficult to reproduce.

adambiggs avatar Apr 20 '15 17:04 adambiggs

Thanks. This also looks like a neovim issue. /cc @tarruda

junegunn avatar Apr 21 '15 00:04 junegunn

@junegunn can you assign this and any other neovim-related issues to me?

tarruda avatar Apr 21 '15 02:04 tarruda

@tarruda Okay, I'll (temporarily) add you as a collaborator. Just a second.

junegunn avatar Apr 21 '15 02:04 junegunn

@tarruda Okay, I'll (temporarily) add you as a collaborator. Just a second.

Thank you, I find easier to keep track of issues if they are assigned to me. I will address them ASAP.

tarruda avatar Apr 21 '15 03:04 tarruda

Thanks once again @tarruda!

adambiggs avatar Apr 21 '15 06:04 adambiggs

Something similar seems to be happening to me, but I don't see any errors in :messages, making it a little hard to debug.

shkm avatar Apr 22 '15 16:04 shkm

I'm observing this as well. Usually on second attempt it works. I failed to reproduce this behaviour intentionally so I didn't raise an issue.

velppa avatar Apr 23 '15 09:04 velppa

Same issue for me

E315: ml_get: invalid lnum: 58 E315: ml_get: invalid lnum: 58 E315: ml_get: invalid lnum: 58 E315: ml_get: invalid lnum: 58 E315: ml_get: invalid lnum: 58 E315: ml_get: invalid lnum: 58 E315: ml_get: invalid lnum: 58 E315: ml_get: invalid lnum: 58 E315: ml_get: invalid lnum: 58

edi9999 avatar May 01 '15 08:05 edi9999

I have the same issue, but I don't get any errors only [Program exited, press any key to close] after selecting the file I want to edit. Also it happens for every file for me, making fzf unusable for me in neovim :( Strangely if I select the file with CTRL-V it works as expected

choco avatar May 01 '15 20:05 choco

@tarruda I'm having issues similar to @cHoco as well.

If I search for and select a file while I already have another file open in the current buffer, I get [Program exited, press any key to close]. However, if the current buffer is empty, :FZF works as expected.

kennethlee avatar May 02 '15 05:05 kennethlee

Having the some issue here, but unlike @kennethlee my case isn't quite as cut and dry. It works in an empty buffer, but sometimes works even if the buffer has a file open and as @adambiggs noted sometimes will be fixed by requesting a split or tab, but not always. It is only consistent as long as I keep trying to open the same file, but as soon as I open it in a clean buffer and close it, I can open it in the dirty buffer that originally failed.

alerque avatar May 02 '15 10:05 alerque

I'm experiencing this, too. I find that opening in a split works, but hitting Enter will actually sometimes result in inserting [Program exited, press any key to close] in the file around the 3rd line, then truncating the file! >_< Just one more reason to love git. :)

e0da avatar May 04 '15 17:05 e0da

For me it is pretty easy to see when the issue happens because it stays in terminal mode after switching to the new buffer. Leaving terminal mode with esc-esc breaks the new buffer with the same issues as justinforce. Reloading with e! % or going back with g- works. Using normal undo doesn't because of the screwed up linenumbers.

Any other button closes the new buffer for me. That buffer doesn't appear on the buffer or jumplist afterwards. Happens when using fzf from empty or loaded buffers seamingly at random.

Tarmean avatar May 23 '15 13:05 Tarmean

Guys, @junegunn, @tarruda

This seems to be fixed properly. Now I can open every files with "Enter" key. Could anyone confirm this so that we could close this issue? Because I updated both neovim and fzf so I don't know which one fixed the bug.

Here is my fzf config that allows me to use to activate fzf window and open new buffer window with Enter key

"" FZF CONFIG
"" ----------
nnoremap <silent> <c-p> :<c-u>call fzf#run({
    \ 'options': '-m',
    \ 'down': 20,
    \ 'sink': 'e'
    \ })<cr>

Here is my OSX 10.10.3 config

❯ fzf --version
0.9.12
❯ nvim --version
NVIM 0.0.0-alpha+201505241705 (compiled May 25 2015 22:36:43)
Commit: d9f97e3026983863d70cbae670bf8277143c8434
Compiled by [email protected]

Optional features included (+) or not (-): +acl   +iconv    +jemalloc
For differences from Vim, see :help vim-differences

   system vimrc file: "$VIM/nvimrc"
     user vimrc file: "~/.nvimrc"
 2nd user vimrc file: "~/.nvim/nvimrc"
      user exrc file: "~/.exrc"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD/share/nvim"

bangedorrunt avatar May 28 '15 14:05 bangedorrunt

Happy to hear it! I went back to vim for the time-being, but FZF breaks zoom in it (as it opens a Tmux pane instead of a Neovim terminal). Will try tomorrow!

shkm avatar May 28 '15 15:05 shkm

Nope, definitely still happening for me when doing two searches in succession.

Tested it roughly ten seconds after updating neovim and pulling/installing fzf so I am pretty sure that it was the newest versions for each.

Tarmean avatar May 28 '15 17:05 Tarmean

There are some open issues about Neovim terminal emulator integration with FZF. Today I have updated both Neovim and FZF and none of them appear to be happening anymore. I use neovim from the custom Ubuntu ppa.

cartolari avatar May 28 '15 17:05 cartolari

Another data point: I updated Neovim and FZF to HEAD and I'm no longer experiencing this.

To update Neovim and FZF, I did this:

brew reinstall --HEAD fzf
brew reinstall --HEAD neovim

This is the output of checking the versions of both:

phong:~% fzf --version
0.9.12
phong:~% nvim --version
NVIM 0.0.0-alpha+201505271256 (compiled May 28 2015 11:52:08)
Commit: ee312ca9a4d35132059db80b13153ce71faa4ae6
Build type: RelWithDebInfo
Compilation: /usr/local/Library/ENV/4.3/clang -Wconversion -O2 -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -I/tmp/neovim20150528-16178-15csfih/build/config -I/tmp/neovim20150528-16178-15csfih/src -I/tmp/neovim20150528-16178-15csfih/.deps/usr/include -I/tmp/neovim20150528-16178-15csfih/.deps/usr/include -I/tmp/neovim20150528-16178-15csfih/.deps/usr/include/luajit-2.0 -I/tmp/neovim20150528-16178-15csfih/.deps/usr/include -I/tmp/neovim20150528-16178-15csfih/.deps/usr/include -I/tmp/neovim20150528-16178-15csfih/.deps/usr/include -I/tmp/neovim20150528-16178-15csfih/.deps/usr/include -I/usr/local/opt/gettext/include -I/usr/include -I/tmp/neovim20150528-16178-15csfih/build/src/nvim/auto -I/tmp/neovim20150528-16178-15csfih/build/include
Compiled by [email protected]

Optional features included (+) or not (-): +acl   +iconv    +jemalloc
For differences from Vim, see :help vim-differences

   system vimrc file: "$VIM/nvimrc"
     user vimrc file: "~/.nvimrc"
 2nd user vimrc file: "~/.nvim/nvimrc"
      user exrc file: "~/.exrc"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD/share/nvim

I'm installing FZF/Neovim via Homebrew on Mac OS X 10.10.3.

e0da avatar May 28 '15 19:05 e0da

@Tarmean what were the precise steps you took to update neovim?

justinmk avatar May 28 '15 20:05 justinmk

Same as @Tarmean for me.

The plugin works for the first 2/3 files, after that, the file doesn't change (but I get no error message), sometimes when I press enter twice, the error message:

E315: ml_get: invalid lnum: 58

appears again

My .nvimrc is quite empty :

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
"
let mapleader = ","

if has('vim_starting')
  " Required:
  set runtimepath+=~/.nvim/bundle/neobundle.vim/
endif

set rtp+=~/.fzf

nnoremap <silent> <C-f> :<c-u>call fzf#run({
    \ 'options': '-m',
    \ 'down': 20,
    \ 'sink': 'e'
    \ })<cr>

" nnoremap <silent> <C-f> :FZF<CR>
command! FZFTag if !empty(tagfiles()) | call fzf#run({
\   'source': "sed '/^\\!/d;s/\t.*//' " . join(tagfiles()) . ' | uniq',
\   'sink':   'tag',
\   'options':  '+m',
\   'left':     60,
\ }) | else | echo 'No tags' | endif

nnoremap <silent> <Leader>t :FZFTag<cr>

To update neovim, I use the add-apt-repository ppa:neovim-ppa/unstable -y

and an apt-get update

Here is the result of

nvim -v
NVIM 0.0.0-alpha (compiled May 27 2015 19:43:48)
Commit: ?
Build type: RelWithDebInfo
Compilation: /usr/bin/x86_64-linux-gnu-gcc -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -DINCLUDE_GENERATED_DECLARATIONS -DHAVE_CONFIG_H -I/build/neovim-Fsnk6w/neovim-0.0.0+git201505271334+1658+9+10~ubuntu15.04.1/build/config -I/build/neovim-Fsnk6w/neovim-0.0.0+git201505271334+1658+9+10~ubuntu15.04.1/src -I/build/neovim-Fsnk6w/neovim-0.0.0+git201505271334+1658+9+10~ubuntu15.04.1/.deps/usr/include -I/build/neovim-Fsnk6w/neovim-0.0.0+git201505271334+1658+9+10~ubuntu15.04.1/.deps/usr/include -I/usr/include/luajit-2.0 -I/build/neovim-Fsnk6w/neovim-0.0.0+git201505271334+1658+9+10~ubuntu15.04.1/.deps/usr/include -I/build/neovim-Fsnk6w/neovim-0.0.0+git201505271334+1658+9+10~ubuntu15.04.1/.deps/usr/include -I/build/neovim-Fsnk6w/neovim-0.0.0+git201505271334+1658+9+10~ubuntu15.04.1/.deps/usr/include -I/build/neovim-Fsnk6w/neovim-0.0.0+git201505271334+1658+9+10~ubuntu15.04.1/.deps/usr/include -I/usr/include -I/build/neovim-Fsnk6w/neovim-0.0.0+git201505271334+1658+9+10~ubuntu15.04.1/build/src/nvim/auto -I/build/neovim-Fsnk6w/neovim-0.0.0+git201505271334+1658+9+10~ubuntu15.04.1/build/include
Compiled by buildd@lgw01-25

Optional features included (+) or not (-): +acl   +iconv    +jemalloc
For differences from Vim, see :help vim-differences

   system vimrc file: "$VIM/nvimrc"
     user vimrc file: "~/.nvimrc"
 2nd user vimrc file: "~/.nvim/nvimrc"
      user exrc file: "~/.exrc"
  fall-back for $VIM: "/usr/share/nvim"

I also have the latest versions of fzf, which I pulled and then run the ./install script.

edi9999 avatar May 29 '15 07:05 edi9999