Skip to content

Commit

Permalink
log: Support skim instead of fzf
Browse files Browse the repository at this point in the history
skim does not support --highlight-line. Perhaps, temporarily.

Link: skim-rs/skim#628
Signed-off-by: Vitaly Chikunov <[email protected]>
  • Loading branch information
vt-alt committed Jan 17, 2025
1 parent a11a8c6 commit 120b63e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions log
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ set -eu +o posix
shopt -s extglob

grepcmd='grep'
selector='fzf --highlight-line'
unset mode offset
for opt do
shift
case "$opt" in
-+([0-9])) offset=${opt#-} ;;
--grep|-ug|--ug|--ugrep|-rg|--rg) grepcmd=${opt##+(-)} ;&
-g) mode=GREP; break ;;
--sk | --skim) selector='sk' ;;
--) break ;;
-*) echo >&2 "Error: unknown option: $opt" ;;
*) set -- "$@" "$opt";;
Expand Down Expand Up @@ -37,13 +39,12 @@ if [ -v offset ]; then
else
# shellcheck disable=SC2012,SC2207,SC2016
files=($(ls -1tr "${files[@]}" |
fzf \
$selector \
--bind='q:abort,/:unbind(q)+unbind(/)' \
--no-mouse \
--no-sort \
--tac \
--multi \
--highlight-line \
--preview-window=80% \
--preview='head -$((LINES/2-1)) {}; echo ...; tail -$((LINES/2)) {}'))
fi
Expand Down

0 comments on commit 120b63e

Please sign in to comment.