diff --git a/TODO b/TODO index 601ccc3..c0c5338 100644 --- a/TODO +++ b/TODO @@ -1,4 +1,4 @@ -- [ ] !!! use file path for git parsing instead of cwd +- [x] !!! use file path for git parsing instead of cwd - [x] add version flag - [x] don't pass `0` line/col to kak diff --git a/scripts/kks-buffers b/scripts/kks-buffers index b99d480..3e087d6 100755 --- a/scripts/kks-buffers +++ b/scripts/kks-buffers @@ -7,13 +7,16 @@ # - 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 -" +history_file="$HOME/.cache/kks-buffers-history" +[ -f "$history_file" ] || touch "$history_file" kks get %val[buflist] | grep -F "$*" | 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])" | + --bind="ctrl-t:execute-silent(kks send edit -scratch {q})+reload(kks get %val[buflist])" \ + --history="$history_file" | while read -r name; do kks send buffer "$name" done diff --git a/scripts/kks-files b/scripts/kks-files index 3e42ec8..eb768fa 100755 --- a/scripts/kks-files +++ b/scripts/kks-files @@ -8,9 +8,12 @@ # - 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" +history_file="$HOME/.cache/kks-files-history" +[ -f "$history_file" ] || touch "$history_file" fd --type file . "$@" | - fzf --multi --height 100% --prompt 'files> ' --preview "$preview_cmd {}" | + fzf --multi --height 100% --prompt 'files> ' \ + --preview "$preview_cmd {}" --history="$history_file" | while read -r file; do kks edit "$file" done diff --git a/scripts/kks-grep b/scripts/kks-grep index 32c181b..062a98d 100755 --- a/scripts/kks-grep +++ b/scripts/kks-grep @@ -6,7 +6,10 @@ # - ripgrep (https://github.com/BurntSushi/ripgrep) # - fzf (https://github.com/junegunn/fzf) +history_file="$HOME/.cache/kks-grep-history" +[ -f "$history_file" ] || touch "$history_file" + rg --vimgrep '.+' "$@" | - fzf --height 100% --prompt 'grep> ' | + fzf --height 100% --prompt 'grep> ' --history="$history_file" | awk -F':' '{print $1 " " "+" $2 ":" $3 }' | xargs -r kks edit