junegunn / fzf.vim

fzf :heart: vim
MIT License
9.52k stars 582 forks source link

Error detected while processing function ... Vim(let):E684: list index out of range:1 #1454

Closed linrongbin16 closed 1 year ago

linrongbin16 commented 1 year ago

Installed with packer.nvim

    use { 'junegunn/fzf', run = ":call fzf#install()", }
    use { 'junegunn/fzf.vim' }

I defined a custom command, trying to find files with fd --no-ignore --hidden:

    command! -bang -nargs=? FzfFilesNoIgnore
        \ call fzf#vim#grep('fd -tf -tl -i -u --exclude ".git" '.shellescape(<q-args>), 0, fzf#vim#with_preview(), <bang>0)

It's good to open fd and fuzzy search a file. But when enter to open the file. There's an error:

image

Please help me with that.

linrongbin16 commented 1 year ago

I have found two similar issues:

The fzf#run and fzf#wrap should solve this issue.

linrongbin16 commented 1 year ago

Finally, the correct command is:

    command! -bang -nargs=? -complete=dir UnrestrictedFiles
        \ call fzf#run(
        \   fzf#vim#with_preview(
        \     fzf#wrap({ 'source': 'fd -tf -tl -i -u --exclude ".git" '.shellescape(<q-args>) }, <bang>0)
        \   )
        \ )