2013-04-18 19:07:31 +02:00
|
|
|
decl str docsclient
|
|
|
|
|
|
|
|
hook global WinSetOption filetype=man %{
|
|
|
|
addhl group man-highlight
|
|
|
|
addhl -group man-highlight regex ^\S.*?$ 0:blue
|
|
|
|
addhl -group man-highlight regex ^\h+-+[-a-zA-Z_]+ 0:yellow
|
|
|
|
addhl -group man-highlight regex [-a-zA-Z_.]+\(\d\) 0:green
|
|
|
|
hook window -id man-hooks NormalKey <c-m> man
|
2013-10-30 10:38:40 +01:00
|
|
|
set buffer tabstop 8
|
2013-04-18 19:07:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
hook global WinSetOption filetype=(?!man).* %{
|
|
|
|
rmhl man-higlight
|
|
|
|
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
|
|
|
|
|
|
|
|
tmpfile=$(mktemp /tmp/kak-man-XXXXXX)
|
|
|
|
MANWIDTH=${kak_window_width} man "$@" | col -b > ${tmpfile}
|
|
|
|
if (( ${PIPESTATUS[0]} == 0 )); then
|
|
|
|
echo "edit! -scratch '*man*'
|
|
|
|
exec |cat<space>${tmpfile}<ret>gk
|
|
|
|
nop %sh{rm ${tmpfile}}
|
2013-10-30 10:38:40 +01:00
|
|
|
set buffer filetype man"
|
2013-04-18 19:07:31 +02:00
|
|
|
else
|
|
|
|
echo "echo %{man '$@' failed: see *debug* buffer for details }"
|
|
|
|
rm ${tmpfile}
|
|
|
|
fi
|
|
|
|
}}
|