2013-04-18 21:07:31 +04: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 13:38:40 +04:00
|
|
|
set buffer tabstop 8
|
2013-04-18 21:07:31 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
hook global WinSetOption filetype=(?!man).* %{
|
|
|
|
rmhl man-higlight
|
|
|
|
rmhooks window man-hooks
|
|
|
|
}
|
|
|
|
|
2013-12-07 17:56:56 +04:00
|
|
|
def -hidden -shell-params _man %{ %sh{
|
2013-04-18 21:07:31 +04:00
|
|
|
tmpfile=$(mktemp /tmp/kak-man-XXXXXX)
|
2014-03-06 07:35:38 +04:00
|
|
|
output=$(MANWIDTH=${kak_window_width} man "$@")
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "${output}" | col -b > ${tmpfile}
|
2013-04-18 21:07:31 +04:00
|
|
|
echo "edit! -scratch '*man*'
|
|
|
|
exec |cat<space>${tmpfile}<ret>gk
|
|
|
|
nop %sh{rm ${tmpfile}}
|
2013-10-30 13:38:40 +04:00
|
|
|
set buffer filetype man"
|
2013-04-18 21:07:31 +04:00
|
|
|
else
|
2014-01-08 23:18:51 +04:00
|
|
|
echo "echo -color Error %{man '$@' failed: see *debug* buffer for details }"
|
2013-04-18 21:07:31 +04:00
|
|
|
rm ${tmpfile}
|
|
|
|
fi
|
2013-12-07 17:56:56 +04:00
|
|
|
} }
|
|
|
|
|
|
|
|
def -shell-params man %{ %sh{
|
2014-03-06 07:35:38 +04:00
|
|
|
[ -z "$@" ] && set -- "$kak_selection"
|
2013-12-07 17:56:56 +04:00
|
|
|
echo "eval -try-client %opt{docsclient} _man $@"
|
|
|
|
} }
|