Skip to content

Commit

Permalink
scripts: add git ls-files picker
Browse files Browse the repository at this point in the history
  • Loading branch information
kkga committed Nov 29, 2021
1 parent de5c15b commit 190b939
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions scripts/kks-git-files
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
#
# pick files from git ls-files
#
# requires:
# - fzf (https://github.com/junegunn/fzf)
# - bat (change to your liking) (https://github.com/sharkdp/bat)

preview_cmd="bat --color=always --line-range=:500"
history_file="$HOME/.cache/kks-files-history"

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

git ls-files . "$@" |
fzf --multi --height 100% --prompt 'files> ' \
--preview "$preview_cmd {}" --history="$history_file" |
while read -r file; do
kks edit "$file"
done

0 comments on commit 190b939

Please sign in to comment.