Skip to content

Commit

Permalink
grep: force sh to be used for fzf preview command
Browse files Browse the repository at this point in the history
Fixes kks-grep preview on non POSIX shells (Fish)

$SHELL variable is usually set to users preferred shell [1]. If set,
FZF uses the variable to run preview command. kks-grep preview command
requires POSIX compatible shell.

[1]: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html#tag_08_03
  • Loading branch information
TeddyDD committed Nov 12, 2021
1 parent cb1d21f commit 95d5f74
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion scripts/kks-grep
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ history_file="$HOME/.cache/kks-grep-history"

[ -f "$history_file" ] || touch "$history_file"

rg --vimgrep '.+' "$@" |
SHELL=sh rg --vimgrep '.+' "$@" |
fzf -d ':' --height 100% --prompt 'grep> ' --history="$history_file" \
--preview='range="$(echo {2}-5 | bc | sed "s/^-.*/0/"):$(echo {2}+20 | bc)"; bat -r "$range" -n --color always -H {2} {1}' |
awk -F':' '{print $1 " " "+" $2 ":" $3 }' |
Expand Down

0 comments on commit 95d5f74

Please sign in to comment.