1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-11-27 02:23:26 +03:00

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 & ( ${kak_opt_grepcmd} "${kak_selection}" | tr -d '\r' >& ${output} ) >& /dev/null < /dev/null &
fi fi
[[ -n "$kak_opt_toolsclient" ]] && echo "eval -client '$kak_opt_toolsclient' %{" echo "eval -try-client '$kak_opt_toolsclient' %{
edit! -fifo ${output} *grep*
echo "edit! -fifo ${output} *grep* set buffer filetype grep
set buffer filetype grep hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }" }"
[[ -n "$kak_opt_toolsclient" ]] && echo "}"
}} }}
hook global WinSetOption filetype=grep %{ hook global WinSetOption filetype=grep %{

View File

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

View File

@ -14,14 +14,7 @@ hook global WinSetOption filetype=(?!man).* %{
rmhooks window man-hooks rmhooks window man-hooks
} }
def -shell-params man %{ %sh{ def -hidden -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
tmpfile=$(mktemp /tmp/kak-man-XXXXXX) tmpfile=$(mktemp /tmp/kak-man-XXXXXX)
MANWIDTH=${kak_window_width} man "$@" | col -b > ${tmpfile} MANWIDTH=${kak_window_width} man "$@" | col -b > ${tmpfile}
if (( ${PIPESTATUS[0]} == 0 )); then if (( ${PIPESTATUS[0]} == 0 )); then
@ -33,4 +26,9 @@ def -shell-params man %{ %sh{
echo "echo %{man '$@' failed: see *debug* buffer for details }" echo "echo %{man '$@' failed: see *debug* buffer for details }"
rm ${tmpfile} rm ${tmpfile}
fi fi
}} } }
def -shell-params man %{ %sh{
[[ -z "$@" ]] && set -- "$kak_selection"
echo "eval -try-client %opt{docsclient} _man $@"
} }