Merge remote-tracking branch 'lenormf/fix-doc-man-bsd'
This commit is contained in:
commit
f682632f9f
|
@ -1,19 +1,21 @@
|
||||||
|
decl str docsclient
|
||||||
|
|
||||||
def -hidden -params 1..2 _doc-open %{
|
def -hidden -params 1..2 _doc-open %{
|
||||||
%sh{
|
%sh{
|
||||||
manout=$(mktemp /tmp/kak-man-XXXXXX)
|
manout=$(mktemp /tmp/kak-man-XXXXXX)
|
||||||
colout=$(mktemp /tmp/kak-man-XXXXXX)
|
|
||||||
|
|
||||||
MANWIDTH=${kak_window_width} man "$1" > $manout
|
# Those options are handled by the `man-db` implementation
|
||||||
retval=$?
|
export MAN_KEEP_FORMATTING=y
|
||||||
|
export MANWIDTH=${kak_window_width}
|
||||||
|
|
||||||
col -b -x > ${colout} < ${manout}
|
# The BSD implementation requires an `-l` flag to detect a filetype as argument
|
||||||
rm ${manout}
|
if man -l "$1" > "${manout}"; then
|
||||||
|
sed -i 's/.\x8//g' "${manout}"
|
||||||
|
|
||||||
if [ "${retval}" -eq 0 ]; then
|
|
||||||
printf %s\\n "
|
printf %s\\n "
|
||||||
edit! -scratch '*doc*'
|
edit! -scratch '*doc*'
|
||||||
exec |cat<space>${colout}<ret>gg
|
exec |cat<space>${manout}<ret>gg
|
||||||
nop %sh{rm ${colout}}
|
nop %sh{rm ${manout}}
|
||||||
set buffer filetype man
|
set buffer filetype man
|
||||||
"
|
"
|
||||||
|
|
||||||
|
@ -23,7 +25,7 @@ def -hidden -params 1..2 _doc-open %{
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
printf %s\\n "echo -color Error %{doc '$@' failed: see *debug* buffer for details}"
|
printf %s\\n "echo -color Error %{doc '$@' failed: see *debug* buffer for details}"
|
||||||
rm ${colout}
|
rm ${manout}
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user