Skip to content

Commit

Permalink
update preview cmd in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
kkga committed Sep 15, 2021
1 parent c5446ee commit c2148fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions scripts/kks-buffers
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
#
# requires:
# - fzf (https://github.com/junegunn/fzf)
# - highlight (faster than bat) (https://gitlab.com/saalen/highlight)
# - highlight (faster than bat, change to your liking) (https://gitlab.com/saalen/highlight)

preview_cmd="highlight --line-range=1-100 -t 4 --force -O ansi -"

kks get %val[buflist] |
grep -F "$*" |
fzf --height 100% --prompt 'buf> ' --preview 'kks cat -b {} | highlight --line-range=1-100 --force -O ansi' \
fzf --height 100% --prompt 'buf> ' --preview "kks cat -b {} | $preview_cmd" \
--header="[c-x] delete, [c-t] new scratch" \
--bind="ctrl-x:execute-silent(kks send -b {} delete-buffer)+reload(kks get %val[buflist])" \
--bind="ctrl-t:execute-silent(kks send edit -scratch {q})+reload(kks get %val[buflist])" |
Expand Down
6 changes: 4 additions & 2 deletions scripts/kks-files
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
# requires:
# - fd (https://github.com/sharkdp/fd)
# - fzf (https://github.com/junegunn/fzf)
# - highlight (faster than bat) (https://gitlab.com/saalen/highlight)
# - highlight (faster than bat, change to your liking) (https://gitlab.com/saalen/highlight)

preview_cmd="highlight --line-range=1-100 -t 4 --force -O ansi"

fd --type file . "$@" |
fzf --multi --height 100% --prompt 'files> ' --preview 'highlight --line-range=1-100 --force -O ansi {}' |
fzf --multi --height 100% --prompt 'files> ' --preview "$preview_cmd {}" |
while read -r file; do
kks edit "$file"
done
4 changes: 3 additions & 1 deletion scripts/kks-mru
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@
# }
# }

(fzf --height 100% --prompt 'mru> ' --preview 'highlight --line-range=1-100 --force -O ansi {}' |
preview_cmd="highlight --line-range=1-100 -t 4 --force -O ansi"

(fzf --height 100% --prompt 'mru> ' --preview "$preview_cmd {}" |
xargs -r kks edit) < ~/.cache/kak-mru

0 comments on commit c2148fe

Please sign in to comment.