add previews to file finders

main
Brian Hicks 2021-07-23 15:33:27 -05:00
parent a9966aac3a
commit f584e4480f
1 changed files with 2 additions and 2 deletions

View File

@ -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}
}
@ -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}
}