Fix man for systems lacking the col command

At least Alpine linux with mandoc does not have the col command,
as it is easy to emulate with sed, fallback onto it when it does
not exist.
This commit is contained in:
Maxime Coste 2021-01-25 17:09:59 +11:00
parent 74fc52b3de
commit b8f1df6458

View File

@ -38,8 +38,13 @@ define-command -hidden -params ..3 man-impl %{ evaluate-commands %sh{
colout=$(mktemp "${TMPDIR:-/tmp}"/kak-man.XXXXXX)
env MANWIDTH=${kak_window_range##* } man "$@" > "$manout" 2> "$manerr"
retval=$?
col -b -x > ${colout} < ${manout}
if command -v col >/dev/null; then
col -b -x > ${colout} < ${manout}
else
sed 's/.//g' > ${colout} < ${manout}
fi
rm ${manout}
if [ "${retval}" -eq 0 ]; then
printf %s\\n "
edit -scratch %{*$buffer_name ${*}*}