use -try-client in kak files rather than ad-hoc shell logic

This commit is contained in:
Maxime Coste 2013-12-07 13:56:56 +00:00
parent 0b473ffe58
commit 9ecfcfad43
3 changed files with 17 additions and 23 deletions

View File

@ -11,13 +11,11 @@ def -shell-params -file-completion \
( ${kak_opt_grepcmd} "${kak_selection}" | tr -d '\r' >& ${output} ) >& /dev/null < /dev/null &
fi
[[ -n "$kak_opt_toolsclient" ]] && echo "eval -client '$kak_opt_toolsclient' %{"
echo "edit! -fifo ${output} *grep*
echo "eval -try-client '$kak_opt_toolsclient' %{
edit! -fifo ${output} *grep*
set buffer filetype grep
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }"
[[ -n "$kak_opt_toolsclient" ]] && echo "}"
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }
}"
}}
hook global WinSetOption filetype=grep %{

View File

@ -6,13 +6,11 @@ def -shell-params make %{ %sh{
mkfifo ${output}
( eval ${kak_opt_makecmd} $@ >& ${output} ) >& /dev/null < /dev/null &
[[ -n "$kak_opt_toolsclient" ]] && echo "eval -client '$kak_opt_toolsclient' %{"
echo "edit! -fifo ${output} *make*
echo "eval -try-client '$kak_opt_toolsclient' %{
edit! -fifo ${output} *make*
set buffer filetype make
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }"
[[ -n "$kak_opt_toolsclient" ]] && echo "}"
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }
}"
}}
defhl make

View File

@ -14,14 +14,7 @@ hook global WinSetOption filetype=(?!man).* %{
rmhooks window man-hooks
}
def -shell-params man %{ %sh{
[[ -z "$@" ]] && set -- "$kak_selection"
# eval in the docsclient context so that kak_window_width is the good one
if [[ -n "$kak_opt_docsclient" && "$kak_client" != "$kak_opt_docsclient" ]]; then
echo "eval -client $kak_opt_docsclient %{ man $@ }"
exit
fi
def -hidden -shell-params _man %{ %sh{
tmpfile=$(mktemp /tmp/kak-man-XXXXXX)
MANWIDTH=${kak_window_width} man "$@" | col -b > ${tmpfile}
if (( ${PIPESTATUS[0]} == 0 )); then
@ -34,3 +27,8 @@ def -shell-params man %{ %sh{
rm ${tmpfile}
fi
} }
def -shell-params man %{ %sh{
[[ -z "$@" ]] && set -- "$kak_selection"
echo "eval -try-client %opt{docsclient} _man $@"
} }