From 8d83a5ff9e59d7a16fca0c3b353ab470c913d942 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Wed, 17 Apr 2013 19:15:15 +0200 Subject: [PATCH] toolsclient option support is back, add docsclient for git-diff --- src/rc/git-tools.kak | 13 +++++++++---- src/rc/grep.kak | 5 +++-- src/rc/make.kak | 5 +++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/rc/git-tools.kak b/src/rc/git-tools.kak index 57d15624..973988af 100644 --- a/src/rc/git-tools.kak +++ b/src/rc/git-tools.kak @@ -1,4 +1,5 @@ decl line-flag-list git_diff_flags +decl str docsclient def git-diff-update-buffer %{ %sh{ added_lines="" @@ -59,10 +60,14 @@ def git-blame %{ def -shell-params git-show %{ %sh{ tmpfile=$(mktemp /tmp/kak-git-show-XXXXXX) if git show "$@" > ${tmpfile}; then - echo "edit! -scratch *git-show* - exec |cat${tmpfile}gk - nop %sh{rm ${tmpfile}} - setb filetype diff" + [[ -n "$kak_opt_docsclient" ]] && echo "eval -client '$kak_opt_docsclient' %{" + + echo "edit! -scratch *git-show* + exec |cat${tmpfile}gk + nop %sh{rm ${tmpfile}} + setb filetype diff" + + [[ -n "$kak_opt_docsclient" ]] && echo "}" else echo "echo %{git show '$@' failed, see *debug* buffer}" rm ${tmpfile} diff --git a/src/rc/grep.kak b/src/rc/grep.kak index 43252a43..3ff91a0f 100644 --- a/src/rc/grep.kak +++ b/src/rc/grep.kak @@ -1,4 +1,5 @@ decl str grepcmd 'grep -RHn' +decl str toolsclient def -shell-params -file-completion \ grep %{ %sh{ @@ -10,13 +11,13 @@ def -shell-params -file-completion \ ( ${kak_opt_grepcmd} "${kak_selection}" | tr -d '\r' >& ${output} ) >& /dev/null < /dev/null & fi - if [[ -n "$kak_opt_toolsclient" ]]; then echo "eval -client '$kak_opt_toolsclient' %{"; fi + [[ -n "$kak_opt_toolsclient" ]] && echo "eval -client '$kak_opt_toolsclient' %{" echo "edit! -fifo ${output} *grep* setb filetype grep hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }" - if [[ -n "$kak_opt_toolsclient" ]]; then echo "}"; fi + [[ -n "$kak_opt_toolsclient" ]] && echo "}" }} hook global WinSetOption filetype=grep %{ diff --git a/src/rc/make.kak b/src/rc/make.kak index 423150e3..694f3415 100644 --- a/src/rc/make.kak +++ b/src/rc/make.kak @@ -1,17 +1,18 @@ decl str makecmd make +decl str toolsclient def -shell-params make %{ %sh{ output=$(mktemp -d -t kak-make.XXXXXXXX)/fifo mkfifo ${output} ( ${kak_opt_makecmd} $@ >& ${output} ) >& /dev/null < /dev/null & - if [[ -n "$kak_opt_toolsclient" ]]; then echo "eval -client '$kak_opt_toolsclient' %{"; fi + [[ -n "$kak_opt_toolsclient" ]] && echo "eval -client '$kak_opt_toolsclient' %{" echo "edit! -fifo ${output} *make* setb filetype make hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }" - if [[ -n "$kak_opt_toolsclient" ]]; then echo "}"; fi + [[ -n "$kak_opt_toolsclient" ]] && echo "}" }} hook global WinSetOption filetype=make %{