From 190b9390a5196a57f0775ed5812d02ebc7ca6dea Mon Sep 17 00:00:00 2001 From: Gadzhi Kharkharov Date: Tue, 30 Nov 2021 01:15:46 +0300 Subject: [PATCH] scripts: add git ls-files picker --- scripts/kks-git-files | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 scripts/kks-git-files diff --git a/scripts/kks-git-files b/scripts/kks-git-files new file mode 100755 index 0000000..c438ec3 --- /dev/null +++ b/scripts/kks-git-files @@ -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