junegunn / fzf.vim

fzf :heart: vim
MIT License
9.66k stars 585 forks source link

Since commit 4145f5 I am getting "Error running" when running Rg, Buffers and maybe other commands #1134

Closed nickjj closed 4 years ago

nickjj commented 4 years ago

Hi,

The error happens when using:


Edit: After a bit of debugging I was able to pin point it down to commit 4145f53f3d343c389ff974b1f1a68eeb39fba18b. If I use any commit before that one then everything works without issues.


Everything was working great for a long time but about a week ago I ran a :PlugUpdate after having not run it for months and now every time I run :Rg foo this error pops up instead of returning the search results:

Error running '/home/nick/.fzf/bin/fzf' '--color=bg+:#f0f0f0,bg:#fafafa,spinner:#a626a4,hl:#a0a1a7,fg:#494b53,header:#a0a1a7,info:#c18401,pointer:#a626a4,marker:#e45649,fg+:#494b53,prompt:#a626a4,hl+:#a626a4' '--ansi' '--prompt' 'Rg> ' '--multi' '--bind' 'alt-a:select-all,alt-d:deselect-all' '--delimiter' ':' '--preview-window' '+{2}-5' '--color' 'hl:4,hl+:12' '-
-preview' ''\''/home/nick/.vim/plugged/fzf.vim/bin/preview.sh'\'' {}' --expect=ctrl-v,ctrl-y,ctrl-b,ctrl-t --height=33 > /tmp/vIyrIcm/5

I have a bit of custom fzf related configuration in my vimrc file but the same error happens even if I remove all of my custom configuration, but here's my custom config for reference since it ties back to the exact error above:

let $FZF_DEFAULT_OPTS = '--bind ctrl-a:select-all'

" Customize fzf colors to match your color scheme.
let g:fzf_colors =
\ { 'fg':      ['fg', 'Normal'],
  \ 'bg':      ['bg', 'Normal'],
  \ 'hl':      ['fg', 'Comment'],
  \ 'fg+':     ['fg', 'CursorLine', 'CursorColumn', 'Normal'],
  \ 'bg+':     ['bg', 'CursorLine', 'CursorColumn'],
  \ 'hl+':     ['fg', 'Statement'],
  \ 'info':    ['fg', 'PreProc'],
  \ 'prompt':  ['fg', 'Conditional'],
  \ 'pointer': ['fg', 'Exception'],
  \ 'marker':  ['fg', 'Keyword'],
  \ 'spinner': ['fg', 'Label'],
  \ 'header':  ['fg', 'Comment'] }

let g:fzf_action = {
  \ 'ctrl-t': 'tab split',
  \ 'ctrl-b': 'split',
  \ 'ctrl-v': 'vsplit',
  \ 'ctrl-y': {lines -> setreg('*', join(lines, "\n"))}}

" Launch fzf with CTRL+P.
nnoremap <silent> <C-p> :FZF -m<CR>

" Map a few common things to do with FZF.
nnoremap <silent> <Leader><Enter> :Buffers<CR>
nnoremap <silent> <Leader>l :Lines<CR>

" Allow passing optional flags into the Rg command.
"   Example: :Rg myterm -g '*.md'
command! -bang -nargs=* Rg
  \ call fzf#vim#grep(
  \ "rg --column --line-number --no-heading --color=always --smart-case " .
  \ <q-args>, 1, fzf#vim#with_preview(), <bang>0)

I also get this error when running the :Buffers command:

Error running cat '/tmp/va2Iesy/6'|'/home/nick/.fzf/bin/fzf' '--color=bg+:#f0f0f0,bg:#fafafa,spinner:#a626a4,hl:#a0a1a7,fg:#494b53,header:#a0a1a7,info:#c18401,pointer:#a626a4,marker:#e45649,fg+:#494b53,prompt:#a626a4,hl+:#a626a4' '+m' '-x' '--tiebreak=index' '--header-lines=1' '--ansi' '-d' '\t' '--with-nth' '3..' '-n' '2,1..2' '--prompt' 'Buf> ' '--query' '' '--
preview-window' '+{2}-5' '--preview-window' 'right' '--preview' ''\''/home/nick/.vim/plugged/fzf.vim/bin/preview.sh'\'' {1}' --expect=ctrl-v,ctrl-y,ctrl-b,ctrl-t --height=33 > /tmp/va2Iesy/5

It's also worth pointing out that finding files to open in fzf is still working and I can run :Commits successfully too. I haven't done an exhaustive check on which commands work and fail but it looks like in this case both commands blow up with preview.sh.

junegunn commented 4 years ago

What's the output of /home/nick/.fzf/bin/fzf --version?

nickjj commented 4 years ago

Hmm, it's 0.21.1 but I did a git pull in ~/.fzf and running git tag there shows 0.22.0. Looks like I needed to also run ./install.

Thanks. It's working now with the latest master commit on both repos after upgrading fzf.

ludovicchabant commented 4 years ago

Yep, same problem here -- I was stuck on fzf 0.18. Works again after upgrading fzf to 0.22. Thanks!

mokagio commented 4 months ago

I landed here because I got an error with a similar report.

It happened after running :PlugUpdate.

I hadn't considered that I might need to check the state of fzf, too. That's silly in hindsight, but one often forgets about these tools after setting them up the first time.

Anyway, brew upgrade fzf brought fzf to the latest version and everything started to work again in Vim.

junegunn commented 4 months ago

@mokagio You can make vim-plug call fzf#install() to automatically download the latest binary after update. This is how it's done.

Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }