Skip to content
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

"E684: list index out of range: 0" when <C-c> in fzf #5

Open
zenazn opened this issue Apr 21, 2020 · 2 comments
Open

"E684: list index out of range: 0" when <C-c> in fzf #5

zenazn opened this issue Apr 21, 2020 · 2 comments

Comments

@zenazn
Copy link

zenazn commented Apr 21, 2020

If you <C-]> / <Plug>(fzf_tags) on a tag with multiple options, then <C-c> without selecting an option in FZF, vim will barf with the following error message:

Error detected while processing function fzf_tags#FindCommand[1]..fzf_tags#Find[12]..fzf#run[69]..<SNR>24_callback:
line   21:
Vim(let):E684: list index out of range: 0
Error detected while processing function fzf_tags#FindCommand[1]..fzf_tags#Find:
line   12:
E171: Missing :endif

I instead expect FZF / fzf-tags to exit without an error and without jumping me anywhere.

I'm pretty bad at vimscript, but adding the following to the top of s:sink seems to fix the problem:

  if len(a:selection) == 0
    return
  end
@zackhsi
Copy link
Owner

zackhsi commented Apr 21, 2020

My specific installation (tmux + nvim + macOS) doesn't actually call s:sink if I <C-c> from the match list.

But without digging too deeply, there's enough branching in fzf#run to make me believe there can be cases where s:sink is called.

If your proposed diff fixes it for you, +1 happy to merge.

@zenazn
Copy link
Author

zenazn commented Jun 3, 2020

I've been running that diff for a month or so now and it seems to fix things for me 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants