mirror of
https://github.com/tomru/DotfilesOld.git
synced 2026-03-03 06:27:21 +01:00
add rga-fzf function
This commit is contained in:
15
zsh/.zsh/functions/rga-fzf
Normal file
15
zsh/.zsh/functions/rga-fzf
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# https://github.com/phiresky/ripgrep-all
|
||||||
|
|
||||||
|
rga-fzf() {
|
||||||
|
RG_PREFIX="rga --files-with-matches"
|
||||||
|
local file
|
||||||
|
file="$(
|
||||||
|
FZF_DEFAULT_COMMAND="$RG_PREFIX '$1'" \
|
||||||
|
fzf --sort --preview="[[ ! -z {} ]] && rga --pretty --context 5 {q} {}" \
|
||||||
|
--phony -q "$1" \
|
||||||
|
--bind "change:reload:$RG_PREFIX {q}" \
|
||||||
|
--preview-window="70%:wrap"
|
||||||
|
)" &&
|
||||||
|
echo "opening $file" &&
|
||||||
|
xdg-open "$file"
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user