0

I have been trying out FZF with Neovim. I installed it via a nvim plugin package manager. I have not installed it for the command line.

When trying to see file previews :FZF --preview="head -$LINES {}" I get the following error: Unknown option $LINES.

It seems that Zshell doesn't like anything I add between the double-quotes e.g.: head -n 10 and will throw an error.

Is this possible from Vim without the FZF command line?

Thanks in advance for your time and help.

2
  • From the README fzf.vim depends on the basic Vim plugin of the main fzf repository, which means you need to set up both "fzf" and "fzf.vim" on Vim. So I never used fzf but I think you won't do much if you don't have fzf installed. Also how did you defined $LINES?
    – statox
    Nov 15, 2018 at 15:29
  • 1
    @statox: FZF is a command from basic fzf Vim plugin, not the fzf.vim extension plugin
    – grodzik
    Nov 16, 2018 at 7:43

1 Answer 1

2

I don't have $LINES defined in my Vim environment, and I'm using Zsh, so it's probably not exported to child processes. However, to make this work you need to remove quotes and escape spaces:

:FZF --preview=head\ -10\ {}

Making $LINES working is more tricky, for basic you could probably add export LINES to your .zshrc, but this won't handle situations, when you resize your terminal window, exported value will still be on the original value. Also, preview window is much smaller than terminal, so this will still be truncated to the size of the preview window.

1
  • Great worked a treat! Thanks for the help.
    – edlee
    Nov 23, 2018 at 22:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.