summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2013-12-07 13:56:56 +0000
committerMaxime Coste <frrrwww@gmail.com>2013-12-07 13:56:56 +0000
commit9ecfcfad43a5958c5153204c2fe28aa6b445e7df (patch)
tree13fe3ff6b5473e73d1344b935bb3200c862b9fbe /src
parent0b473ffe5801452652c2c3a95c7d1c6db44df54b (diff)
use -try-client in kak files rather than ad-hoc shell logic
Diffstat (limited to 'src')
-rw-r--r--src/rc/grep.kak12
-rw-r--r--src/rc/make.kak12
-rw-r--r--src/rc/man.kak16
3 files changed, 17 insertions, 23 deletions
diff --git a/src/rc/grep.kak b/src/rc/grep.kak
index b98708b0..ecebdfd7 100644
--- a/src/rc/grep.kak
+++ b/src/rc/grep.kak
@@ -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*
- set buffer filetype grep
- hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }"
-
- [[ -n "$kak_opt_toolsclient" ]] && echo "}"
+ echo "eval -try-client '$kak_opt_toolsclient' %{
+ edit! -fifo ${output} *grep*
+ set buffer filetype grep
+ hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }
+ }"
}}
hook global WinSetOption filetype=grep %{
diff --git a/src/rc/make.kak b/src/rc/make.kak
index cd2fd220..37d299a4 100644
--- a/src/rc/make.kak
+++ b/src/rc/make.kak
@@ -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*
- set buffer filetype make
- hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }"
-
- [[ -n "$kak_opt_toolsclient" ]] && echo "}"
+ echo "eval -try-client '$kak_opt_toolsclient' %{
+ edit! -fifo ${output} *make*
+ set buffer filetype make
+ hook buffer BufClose .* %{ nop %sh{ rm -r $(dirname ${output}) } }
+ }"
}}
defhl make
diff --git a/src/rc/man.kak b/src/rc/man.kak
index 386f2df0..8d61a4f1 100644
--- a/src/rc/man.kak
+++ b/src/rc/man.kak
@@ -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
@@ -33,4 +26,9 @@ def -shell-params man %{ %sh{
echo "echo %{man '$@' failed: see *debug* buffer for details }"
rm ${tmpfile}
fi
-}}
+} }
+
+def -shell-params man %{ %sh{
+ [[ -z "$@" ]] && set -- "$kak_selection"
+ echo "eval -try-client %opt{docsclient} _man $@"
+} }