Fix man command
This commit is contained in:
parent
f733007a7b
commit
03760e5ba1
18
rc/man.kak
18
rc/man.kak
|
@ -15,17 +15,21 @@ hook global WinSetOption filetype=(?!man).* %{
|
||||||
}
|
}
|
||||||
|
|
||||||
def -hidden -shell-params _man %{ %sh{
|
def -hidden -shell-params _man %{ %sh{
|
||||||
tmpfile=$(mktemp /tmp/kak-man-XXXXXX)
|
manout=$(mktemp /tmp/kak-man-XXXXXX)
|
||||||
output=$(MANWIDTH=${kak_window_width} man "$@")
|
colout=$(mktemp /tmp/kak-man-XXXXXX)
|
||||||
if [ $? -eq 0 ]; then
|
MANWIDTH=${kak_window_width} man "$@" > $manout
|
||||||
echo "${output}" | col -b > ${tmpfile}
|
retval=$?
|
||||||
|
col -b > ${colout} < ${manout}
|
||||||
|
rm ${manout}
|
||||||
|
if [ "${retval}" -eq 0 ]; then
|
||||||
|
echo "${output}" |
|
||||||
echo "edit! -scratch '*man*'
|
echo "edit! -scratch '*man*'
|
||||||
exec |cat<space>${tmpfile}<ret>gk
|
exec |cat<space>${colout}<ret>gk
|
||||||
nop %sh{rm ${tmpfile}}
|
nop %sh{rm ${colout}}
|
||||||
set buffer filetype man"
|
set buffer filetype man"
|
||||||
else
|
else
|
||||||
echo "echo -color Error %{man '$@' failed: see *debug* buffer for details }"
|
echo "echo -color Error %{man '$@' failed: see *debug* buffer for details }"
|
||||||
rm ${tmpfile}
|
rm ${colout}
|
||||||
fi
|
fi
|
||||||
} }
|
} }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user