From f584e4480f6ff5702ff398e44329727bcff45e18 Mon Sep 17 00:00:00 2001 From: Brian Hicks Date: Fri, 23 Jul 2021 15:33:27 -0500 Subject: [PATCH] add previews to file finders --- pkgs/kak-open/rc/kak-open.kak | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/kak-open/rc/kak-open.kak b/pkgs/kak-open/rc/kak-open.kak index e3d7541..38f4924 100644 --- a/pkgs/kak-open/rc/kak-open.kak +++ b/pkgs/kak-open/rc/kak-open.kak @@ -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} }