grep,make: support specifying client with toolsclient option

When toolsclient option is set, make and grep opens their buffer
in the specified client instead of the current one.
This commit is contained in:
Maxime Coste 2013-02-21 13:38:12 +01:00
parent 901d5ea1be
commit efc0a8bc07
2 changed files with 10 additions and 0 deletions

View File

@ -9,10 +9,15 @@ def -shell-params -file-completion \
else else
( ${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
if [[ -n "$kak_opt_toolsclient" ]]; then echo "eval -client '$kak_opt_toolsclient' %{"; fi
echo "try %{ db *grep* } catch %{} echo "try %{ db *grep* } catch %{}
edit -fifo ${output} *grep* edit -fifo ${output} *grep*
setb filetype grep setb filetype grep
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }" hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }"
if [[ -n "$kak_opt_toolsclient" ]]; then echo "}"; fi
}} }}
hook global WinSetOption filetype=grep %{ hook global WinSetOption filetype=grep %{

View File

@ -4,10 +4,15 @@ def -shell-params make %{ %sh{
output=$(mktemp -d -t kak-make.XXXXXXXX)/fifo output=$(mktemp -d -t kak-make.XXXXXXXX)/fifo
mkfifo ${output} mkfifo ${output}
( ${kak_opt_makecmd} $@ >& ${output} ) >& /dev/null < /dev/null & ( ${kak_opt_makecmd} $@ >& ${output} ) >& /dev/null < /dev/null &
if [[ -n "$kak_opt_toolsclient" ]]; then echo "eval -client '$kak_opt_toolsclient' %{"; fi
echo "try %{ db *make* } catch %{} echo "try %{ db *make* } catch %{}
edit -fifo ${output} *make* edit -fifo ${output} *make*
setb filetype make setb filetype make
hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }" hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }"
if [[ -n "$kak_opt_toolsclient" ]]; then echo "}"; fi
}} }}
hook global WinSetOption filetype=make %{ hook global WinSetOption filetype=make %{