Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Unable to successfully set up FZF_DEFAULT_COMMAND



I'm running MacOS on a fresh user install.

I'm trying to integrate the 'rg' command with fzf. The README page for fzf says to insert the following line into .zshrc:

INITIAL_QUERY=""
RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "
FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \
  fzf --bind "change:reload:$RG_PREFIX {q} || true" \
      --ansi --disabled --query "$INITIAL_QUERY" \
      --height=50% --layout=reverse

When I do add these lines, there are two problems:

1) When I reload zsh, the fzf command gets run with the rg command immediately. 2) When I type 'echo $FZF_DEFAULT_COMMAND' at the command prompt, the FZF_DEFAULT_COMMAND is not set. And then when I run 'fzf', I'll just get the default fzf behavior.

When I try adding the "export" keyword to export the FZF_DEFAULT_COMMAND but that results in an error:

/Users/test/.zshrc:export:3: not valid in this context: --bind. And 'echo $FZF_DEFAULT_COMMAND' shows just:

rg --column --line-number --no-heading --color=always --smart-case  ''

I've searched around a great deal but I'm coming up empty. Can someone explain why I can't get this working?




Messages sorted by: Reverse Date, Date, Thread, Author