michal-h21/vim-zettel

ZettelOpen and ZettelSearch fail because of an "Error running fzf..."

sbicknel opened this issue · 28 comments

I tried starting with a fresh Vim configuration, reinstalling Vundle, fzf, fzf.vim, Vimwiki, and Vim-Zettel and rebuilding my configuration from scratch. I also tried configuring the g:zettel_fzf_command variable with "rg --column --line-number --ignore-case --no-heading --color=always " as I have both fzf and rg on my system and set the g:nv_search_paths variable to the location of my zettelkasten. Nothing seems to make a difference.

Do commands provided by fzf.vim work? What is the full error you get?

Maybe there is some error message in /tmp/veQ0wKo/0 file? I've found only similar issue here: junegunn/fzf#1486. It is possible that it is caused by the preview window. Does fzf --preview 'echo {}' command work?

I honestly don't know what the issue can be. Can you please share your .vimrc?

The only other thing in can add is something I just noticed while trying to run those commands again. The window splits horizontally (to be expected for the fzf output) and a message appears for about half a second that starts out with "Invalid preview window" but then disappears before I can finish reading it. That message does not appear on subsequent attempts to run ZettelOpen or ZettelSearch and it not present in the output of :messages.

It really seems to be an issue caused by the preview window. Your .vimrc works fine on my system (Fedora 31), except that it doesn't conceal links. But :ZettelOpen works, as well as your custom mappings using <leader>zo.

You may try if the preview window works in Vim at all on your system (we know that it works on the command line already). Try to define the following command:

command! -bang -nargs=? -complete=dir Files call fzf#vim#files(<q-args>, fzf#vim#with_preview({'options': ['--layout=reverse', '--info=inline']}), <bang>0)

And execute it using :Files then. If it doesn't work, then the issue is probably in FZF. If it works, then I honestly don't know what the issue is and how to locate it :/

I am having the same issue. FZF search initiated by [[ was working before I updated my vim-zettel plugin. I must note that I have updated all my plugins installed via vundle at once. Here is the error message:

Error running 'fzf'  '--ansi' '--prompt' 'Ag> ' '--multi' '--bind' 'alt-a:select-all,alt-d:deselect-all' '--delimiter' ':' '--preview-window' '+{2}-5' '--
color' 'hl:4,hl+:12' '--exact' '--tiebreak=end' '--preview' ''\''/Users/tasdemir/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdem
ir/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdemir/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdemir
/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdemir/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdemir/.
vim/bundle/fzf.vim/bin/preview.sh'\'' {}' '--preview' ''\''/Users/tasdemir/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' --no-height > /var/folders/g5/p2zgvr
5j54s5w2l0j_mxvdy00000gn/T/vQwcKC5/7

I've tried another machine and I can confirm this issue now. The good thing is that I will be able to debug it now :)

I've found the issue is a recent change in fzf.vim. It is basically the same issue as this. I was able to fix that by update of the FZF binary. FZF.vim readme states that it needs FZF v22. My Linux distro contains only FZF v21, so I had to update it manually from Github.

I've found the issue is a recent change in fzf.vim. It is basically the same issue as this. I was able to fix that by update of the FZF binary. FZF.vim readme states that it needs FZF v22. My Linux distro contains only FZF v21, so I had to update it manually from Github.

I updated to 0.22 but same issue with fzf.vim.

The following code from fzf.vim documentation failed for me with FZF 21, but it works for me with FZF 22:

function! RipgrepFzf(query, fullscreen)
  let command_fmt = 'rg --column --line-number --no-heading --color=always --smart-case -- %s || true'
  let initial_command = printf(command_fmt, shellescape(a:query))
  let reload_command = printf(command_fmt, '{q}')
  let spec = {'options': ['--phony', '--query', a:query, '--bind', 'change:reload:'.reload_command]}
  call fzf#vim#grep(initial_command, 1, fzf#vim#with_preview(spec), a:fullscreen)
endfunction

command! -nargs=* -bang RG call RipgrepFzf(<q-args>, <bang>0)

It uses the same functions as we use in Vim-zettel (fzf#vim#grep and fzf#vim#with_preview).

@michal-h21 yes, true. It works 🎉 Thank you

@michal-h21 apologize, I thought it was working but, it was not at my end. I updated to 0.22. 🤦‍♂️

@ismatim and the :RG command from my previous comment doesn't work as well?

@ismatim and the :RG command from my previous comment doesn't work as well?

@michal-h21:

Not really, I got E471: Argument required.

This is the previous one:
\'command! -bang -nargs=* Rg call fzf#vim#grep("rg --column --line-number --no-heading --color=always --smart-case -- ".shellescape(<q-args>), 1, s:p(<bang>0), <bang>0)',

And, the error output in osx with fzf 0.22:
Error running '/Users/me/.vim/bundle/fzf/bin/fzf' --history '/Users/me/.local/share/fzf-history/rg' '--color=bg+:238,bg:235,border:0,spinner:228,hl:245,fg:231,header:245,info:197,poi nter:197,marker:197,fg+:231,prompt:197,hl+:197' '--ansi' '--prompt' 'Rg> ' '--multi' '--bind' 'alt-a:select-all,alt-d:deselect-all' '--delimiter' ':' '--preview-window' '+{2}-5' '--color' 'hl:4,hl+:12' '--preview -window' 'right' '--preview' ''\''/Users/me/.vim/bundle/fzf.vim/bin/preview.sh'\'' {}' --expect=ctrl-v,ctrl-x,ctrl-t --no-height > /var/folders/g4/47bp_8s521b2d5s764qhgg480000gn/T/nvimQizRbL/1

I believe that the issue is caused by this argument to FZF, which seems to not work in it's earlier versions: '--preview-window' '+{2}-5' . It was introduced in this FZF.vim commit, on line 747.

Adding a bit of info - I get this error while working in macos 11 (Big Sur) beta, but not on another machine running macos 10.15.x.

Other than that, these machine are identical. Same brewed binaries, same vim config...

I've added comment to the FZF.vim issue tracker, so I hope they will fix it for all FZF versions.

@michal-h21 I upgraded my freebsd machine to latest port with fzf 0.22 and it works, it wasn't working before. In osx I had to downgraded the HEAD~1 in fzf.vim repo. But, there is a breaking change certainly in last commit. Thank you.

The same issue on Ubuntu

I've updated the README with the known issues section. The FZF update is probably only advice I can give now :/

Yes, updating solves the problem (mac OS).

I ran into this issue yesterday with fresh installs on both Mac and Ubuntu using author's suggested vimrc with vim. On a whim, today, I installed neovim. The errors completely go away using neovim.

Ran with the same issue while having the latest fzf. Solve it by reinstalling both FZF and the vim-zettel plugins.