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 #462

Closed
5 of 9 tasks
terkelg opened this issue Oct 12, 2017 · 5 comments
Closed
5 of 9 tasks

E684: list index out of range: 0 #462

terkelg opened this issue Oct 12, 2017 · 5 comments

Comments

@terkelg
Copy link

terkelg commented Oct 12, 2017

  • Category
    • Question
    • Bug
    • Suggestion
  • OS
    • Linux
    • macOS
    • Windows
    • Etc.
  • Vim
    • Vim
    • Neovim

I'm getting the following error E684: list index out of range: 0 when I run fzf with rg --files, and hit enter. I'm not sure how to debug this, and I've never done any vim development. How can I get more debugging information?

It happens in both neovim and vim.
This is how it looks in my .vimrc:

" FILES (This command fails)
let g:open_command = 'rg --files --hidden --follow --ignore-case --fixed-strings -g "!{.git,node_modules}"'
command! -bang -nargs=* R call fzf#vim#grep(g:open_command .shellescape(<q-args>), 1, <bang>0 ? fzf#vim#with_preview('right:50%') : fzf#vim#with_preview('right:50%:hidden', '?'), <bang>0)

" SEARCH IN FILES
let g:files_command = '
    \ rg --column --line-number --fixed-strings --ignore-case --no-ignore --hidden --follow --color "always"
    \ -g "!{.git,node_modules,build,yarn.lock,dist}/*" '

command! -bang -nargs=* Rg call fzf#vim#grep(g:files_command .shellescape(<q-args>), 1, <bang>0 ? fzf#vim#with_preview('up:60%') : fzf#vim#with_preview('right:50%', '?'), <bang>0)

I'm pretty sure it has something to do with the --files flag.
rg --files works fine in the terminal, outside vim.

neovim error:

Error detected while processing function 270[30]..<SNR>42_callback:
line   33:
Vim(let):E684: list index out of range: 1

vim error:

Error detected while processing function fzf#vim#grep[22]..<SNR>86_fzf[18]..fzf#
run[69]..<SNR>42_callback:
line   33:
Vim(let):E684: list index out of range: 1

NVIM v0.2.1-dev
Build type: Release
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/super/clang -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_MSGPACK_HAS_FLOAT32 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -I/tmp/neovim-20170705-12392-18v0b8r/build/config -I/tmp/neovim-20170705-12392-18v0b8r/src -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/include -I/usr/local/opt/gettext/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include -I/tmp/neovim-20170705-12392-18v0b8r/build/src/nvim/auto -I/tmp/neovim-20170705-12392-18v0b8r/build/include
Compiled by ******@******.local

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-c07e144/share/nvim"
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct  5 2017 19:19:02)
MacOS X (unix) version
Included patches: 1-1175
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl             +file_in_path    +mouse_sgr       +tag_old_static
+arabic          +find_in_path    -mouse_sysmouse  -tag_any_white
+autocmd         +float           +mouse_urxvt     -tcl
-balloon_eval    +folding         +mouse_xterm     +termguicolors
-browse          -footer          +multi_byte      +terminal
++builtin_terms  +fork()          +multi_lang      +terminfo
+byte_offset     -gettext         -mzscheme        +termresponse
+channel         -hangul_input    +netbeans_intg   +textobjects
+cindent         +iconv           +num64           +timers
-clientserver    +insert_expand   +packages        +title
+clipboard       +job             +path_extra      -toolbar
+cmdline_compl   +jumplist        +perl            +user_commands
+cmdline_hist    +keymap          +persistent_undo +vertsplit
+cmdline_info    +lambda          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con      -lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      -X11
-dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     -xim
+emacs_tags      -mouseshape      +startuptime     -xpm
+eval            +mouse_dec       +statusline      -xsmp
+ex_extra        -mouse_gpm       -sun_workshop    -xterm_clipboard
+extra_search    -mouse_jsbterm   +syntax          -xterm_save
+farsi           +mouse_netterm   +tag_binary
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: clang   -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib  -L/usr/local/lib -o vim        -lncurses -liconv -framework Cocoa   -mmacosx-version-min=10.12 -fstack-protector-strong -L/usr/local/lib  -L/usr/local/Cellar/perl/5.26.1/lib/perl5/5.26.1/darwin-thread-multi-2level/CORE -lperl -lm -lutil -lc -F/usr/local/opt/python/Frameworks -framework Python   -lruby.2.4.2 -lobjc

screen shot 2017-10-11 at 23 13 57

Thanks for the amazing work on FZF

@junegunn
Copy link
Owner

fzf#vim#grep is for file content search, e.g. rg foo, where each line prints the location of the match. rg --files only lists the file paths, and you should use it with fzf#vim#files.

@terkelg
Copy link
Author

terkelg commented Oct 12, 2017

Thanks @junegunn - It worked.
I wanted to overwrite my default command, so ended up with this:

command! -bang -nargs=* AllFiles call fzf#run(fzf#wrap(
    \ {'source': 'rg --files --hidden --no-ignore --follow --ignore-case'}, <bang>0 ? fzf#vim#with_preview('right:50%') : fzf#vim#with_preview('right:50%:hidden', '?'), <bang>0)

@terkelg terkelg closed this as completed Oct 12, 2017
@Nitrodist
Copy link

Nitrodist commented Dec 7, 2022

fzf#vim#grep is for file content search, e.g. rg foo, where each line prints the location of the match. rg --files only lists the file paths, and you should use it with fzf#vim#files.

@junegunn This helped me understand how to (not) integrate the fd command, thanks!

@linrongbin16
Copy link

@terkelg, I think your command missed a close parenthese at the end.

@linrongbin16
Copy link

@junegunn Hi, would you please help with how to implement this command with fzf#vim#files function?

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

4 participants