use extra command parameter to do extra commands after main command
This commit is contained in:
parent
53f280dde8
commit
90f958819d
3 changed files with 8 additions and 5 deletions
|
@ -26,6 +26,6 @@ define-command -hidden fzf-cd %{ evaluate-commands %sh{
|
||||||
*)
|
*)
|
||||||
items_command=$kak_opt_fzf_cd_command ;;
|
items_command=$kak_opt_fzf_cd_command ;;
|
||||||
esac
|
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}"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,6 @@ define-command -hidden fzf-buffer-search %{ evaluate-commands %sh{
|
||||||
printf "%s\n" "info -title '$title' '$message'"
|
printf "%s\n" "info -title '$title' '$message'"
|
||||||
buffer_content=$(mktemp ${TMPDIR:-/tmp}/fzf-buff-${kak_buffile##*/}.XXXXXX)
|
buffer_content=$(mktemp ${TMPDIR:-/tmp}/fzf-buff-${kak_buffile##*/}.XXXXXX)
|
||||||
printf "%s\n" "execute-keys -draft %{%<a-|>cat<space>><space>$buffer_content<ret>;}"
|
printf "%s\n" "execute-keys -draft %{%<a-|>cat<space>><space>$buffer_content<ret>;}"
|
||||||
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}"
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
|
@ -63,10 +63,11 @@ Best used with mapping like:
|
||||||
" \
|
" \
|
||||||
fzf-mode %{ try %{ evaluate-commands 'enter-user-mode fzf' } }
|
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
|
callback=$1
|
||||||
items_command=$2
|
items_command=$2
|
||||||
additional_flags=$3
|
additional_flags=$3
|
||||||
|
extra_action=$4
|
||||||
tmux_height=$kak_opt_fzf_tmux_height
|
tmux_height=$kak_opt_fzf_tmux_height
|
||||||
|
|
||||||
items_executable=$(printf "%s\n" "$items_command" | grep -o -E "[[:alpha:]]+" | head -1)
|
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 ;;
|
[ -n "$action" ] && printf "%s\n" "evaluate-commands -client $kak_client '$callback' '$action'" | kak -p $kak_session ;;
|
||||||
esac
|
esac
|
||||||
kakoune_command() {
|
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
|
while read item; do
|
||||||
kakoune_command "$item" | kak -p $kak_session
|
kakoune_command "$item" | kak -p $kak_session
|
||||||
done
|
done
|
||||||
|
[ -n "$extra_action" ] && printf "%s\n" "evaluate-commands -client $kak_client $extra_action" | kak -p $kak_session
|
||||||
) < $tmp
|
) < $tmp
|
||||||
fi
|
fi
|
||||||
rm $tmp
|
rm $tmp
|
||||||
) > /dev/null 2>&1 < /dev/null &
|
) &
|
||||||
|
# > /dev/null 2>&1 < /dev/null &
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue