From 3e07f246da93ef1cfe123fb9be6bc68455882a03 Mon Sep 17 00:00:00 2001 From: Noah Pederson Date: Wed, 12 Jun 2024 18:58:19 -0500 Subject: [PATCH] ADD frv command, from fzf wiki --- fish/functions/rfv.fish | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 fish/functions/rfv.fish diff --git a/fish/functions/rfv.fish b/fish/functions/rfv.fish new file mode 100644 index 0000000..b05c8f3 --- /dev/null +++ b/fish/functions/rfv.fish @@ -0,0 +1,20 @@ +# ripgrep->fzf->nvim [QUERY] +# Ripped from: https://junegunn.github.io/fzf/tips/ripgrep-integration/ +function rfv + set -lx RELOAD 'reload:rg --column --color=always --smart-case {q} || :' + set -lx OPENER 'if [[ $FZF_SELECT_COUNT -eq 0 ]]; then + nvim {1} +{2} # No selection. Open the current line in Vim. + else + nvim +cw -q {+f} # Build quickfix list for the selected items. + fi' + fzf < /dev/null \ + --disabled --ansi --multi \ + --bind "start:$RELOAD" --bind "change:$RELOAD" \ + --bind "enter:become:$OPENER" \ + --bind "ctrl-o:execute:$OPENER" \ + --bind 'alt-a:select-all,alt-d:deselect-all,ctrl-/:toggle-preview' \ + --delimiter : \ + --preview 'bat --style=full --color=always --highlight-line {2} {1}' \ + --preview-window '~4,+{2}+4/3,<80(up)' \ + --query "$argv" +end -- 2.51.2