Skip to content

Commit

Permalink
add previews to file finders
Browse files Browse the repository at this point in the history
  • Loading branch information
BrianHicks committed Jul 23, 2021
1 parent a9966aa commit f584e44
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkgs/kak-open/rc/kak-open.kak
Expand Up @@ -3,7 +3,7 @@ declare-option str similar_sort_path "similar-sort"
define-command -docstring 'open files named similarly to the current buffer' open-similar %{
tmux-terminal-impl 'display-popup -E' sh -c %{
set -euo pipefail
FILE="$(git ls-files --others --cached --exclude-standard | $1 $2 | grep -Ev "^$2\$" | fzf --tiebreak index)"
FILE="$(git ls-files --others --cached --exclude-standard | $1 $2 | grep -Ev "^$2\$" | fzf --tiebreak index --preview "bat --color=always -p {}")"
printf "evaluate-commands -client %s edit %s\n" "$3" "$FILE" | indiekak -p $4
} -- %opt{similar_sort_path} %val{bufname} %val{client} %val{session}
}
Expand All @@ -16,7 +16,7 @@ define-command -docstring 'open buffers named similarly to the current buffer' o
OPTIONS="$(printf "%s\n%s" "$OPTIONS" "$OPTION")"
done

BUFFER="$(echo "$OPTIONS" | $1 $2 | grep -Ev "^$2\$" | grep -ve '^$' | fzf --tiebreak index)"
BUFFER="$(echo "$OPTIONS" | $1 $2 | grep -Ev "^$2\$" | grep -ve '^$' | fzf --tiebreak index --preview "bat --color=always -p {}")"
printf "evaluate-commands -client %s edit '%s'\n" "$3" "$BUFFER" | indiekak -p $4
} -- %opt{similar_sort_path} %val{bufname} %val{client} %val{session} %val{buflist}
}

0 comments on commit f584e44

Please sign in to comment.