# define-command run-tv %{ evaluate-commands %sh{ # # Create a temporary fifo for communication # tv_tmp="$(mktemp -d "${TMPDIR:-/tmp}"/tv.kak.XXXXXX)" # tv_out="${tv_tmp}/tvcmd" # result="${tv_tmp}/result" # mkfifo ${tv_out} # # run command detached from the shell # { tv > ${tv_out} } > /dev/null 2>&1 < /dev/null & # # Open the file in Kakoune and add a hook to remove the fifo # echo "edit! -fifo ${tv_out} *buffer-name* # hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${tv_tmp})} }" # } # } # # define-command bla %{ evaluate-commands %sh{ # Create a temporary fifo for communication output=$(mktemp -d -t kak-temp-XXXXXXXX)/fifo mkfifo ${output} # run command detached from the shell { lazygit > ${output} } > /dev/null 2>&1 < /dev/null & # Open the file in Kakoune and add a hook to remove the fifo echo "edit! -fifo ${output} *buffer-name* hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output})} }" } }