diff options
| author | Maxime Coste <mawww@kakoune.org> | 2021-01-25 17:09:59 +1100 |
|---|---|---|
| committer | Maxime Coste <mawww@kakoune.org> | 2021-01-26 09:28:24 +1100 |
| commit | b8f1df6458f5330ca1c1da0e8cfcebe41f2baf6e (patch) | |
| tree | 1ab97c79a95b6b4502b154bfa7618a9b7cbde068 | |
| parent | 74fc52b3de6927632b5a8484f68f68bd34f383d5 (diff) | |
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.
| -rw-r--r-- | rc/tools/man.kak | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/rc/tools/man.kak b/rc/tools/man.kak index ecf237bd..5e57dc06 100644 --- a/rc/tools/man.kak +++ b/rc/tools/man.kak @@ -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 ${*}*} |
