From 38185dda21eae77ccd9b8bd6a683ae4d657627e8 Mon Sep 17 00:00:00 2001 From: phiresky Date: Sun, 7 Jun 2020 23:50:59 +0200 Subject: [PATCH] fix "no such file" in rga-fzf --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 16aa4fb..b1f1be4 100644 --- a/README.md +++ b/README.md @@ -31,15 +31,15 @@ demo/ ![rga-fzf](doc/rga-fzf.gif) -You can use rga interactively. Add the following to your ~/.{bash,zsh}rc: +You can use rga interactively via fzf. Add the following to your ~/.{bash,zsh}rc: ```bash rga-fzf() { - RG_PREFIX="rga --files-with-matches --rga-cache-max-blob-len=10M $RGA_ARGS" + RG_PREFIX="rga --files-with-matches --rga-cache-max-blob-len=10M" local file file="$( FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \ - fzf --sort --preview="rga --pretty --context 5 {q} {}" \ + fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \ --phony -q "$1" \ --bind "change:reload:$RG_PREFIX {q}" \ --preview-window="70%:wrap"