diff --git a/rc/fzf-modules/fzf-cd.kak b/rc/fzf-modules/fzf-cd.kak index 3fea3ab..a8c9e80 100644 --- a/rc/fzf-modules/fzf-cd.kak +++ b/rc/fzf-modules/fzf-cd.kak @@ -26,6 +26,6 @@ define-command -hidden fzf-cd %{ evaluate-commands %sh{ *) items_command=$kak_opt_fzf_cd_command ;; esac - printf "%s\n" "fzf %{change-directory} %{$items_command} %{&& printf '%s\n' '; evaluate-commands fzf-cd'}" + printf "%s\n" "fzf %{change-directory} %{$items_command} %{} %{fzf-cd}" }} diff --git a/rc/fzf-modules/fzf-search.kak b/rc/fzf-modules/fzf-search.kak index c954a16..b961e60 100644 --- a/rc/fzf-modules/fzf-search.kak +++ b/rc/fzf-modules/fzf-search.kak @@ -16,6 +16,6 @@ define-command -hidden fzf-buffer-search %{ evaluate-commands %sh{ printf "%s\n" "info -title '$title' '$message'" buffer_content=$(mktemp ${TMPDIR:-/tmp}/fzf-buff-${kak_buffile##*/}.XXXXXX) printf "%s\n" "execute-keys -draft %{%cat>$buffer_content;}" - printf "%s\n" "fzf %{execute-keys} %{(nl -b a -n ln $buffer_content} %{--reverse | cut -f 1; rm $buffer_content; echo 'gx')}" + printf "%s\n" "fzf %{execute-keys} %{(nl -b a -n ln $buffer_content} %{--reverse | cut -f 1; rm $buffer_content)} %{execute-keys gx}" }} diff --git a/rc/fzf.kak b/rc/fzf.kak index 3083563..3692dbf 100644 --- a/rc/fzf.kak +++ b/rc/fzf.kak @@ -63,10 +63,11 @@ Best used with mapping like: " \ fzf-mode %{ try %{ evaluate-commands 'enter-user-mode fzf' } } -define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{ +define-command -hidden fzf -params 2..4 %{ evaluate-commands %sh{ callback=$1 items_command=$2 additional_flags=$3 + extra_action=$4 tmux_height=$kak_opt_fzf_tmux_height items_executable=$(printf "%s\n" "$items_command" | grep -o -E "[[:alpha:]]+" | head -1) @@ -139,14 +140,16 @@ define-command -hidden fzf -params 2..3 %{ evaluate-commands %sh{ [ -n "$action" ] && printf "%s\n" "evaluate-commands -client $kak_client '$callback' '$action'" | kak -p $kak_session ;; esac kakoune_command() { - printf "%s\n" "evaluate-commands -client $kak_client '$wincmd $callback' '$1'" + printf "%s\n" "evaluate-commands -client $kak_client $wincmd $callback %{$1}" } while read item; do kakoune_command "$item" | kak -p $kak_session done + [ -n "$extra_action" ] && printf "%s\n" "evaluate-commands -client $kak_client $extra_action" | kak -p $kak_session ) < $tmp fi rm $tmp - ) > /dev/null 2>&1 < /dev/null & + ) & + # > /dev/null 2>&1 < /dev/null & }}