Bash: fix man apropos functionality
This commit is contained in:
parent
0d83b26079
commit
397e891010
1 changed files with 6 additions and 2 deletions
|
@ -66,6 +66,7 @@ sww() {
|
|||
# Proper manpages ===================================================
|
||||
man() {
|
||||
local command=$(IFS=-, ; echo "$*")
|
||||
local -r man="$(which man | tail -n1)"
|
||||
|
||||
# When section is specified,override
|
||||
if [[ "$1" =~ ^[1-7]$ ]]; then
|
||||
|
@ -74,7 +75,10 @@ man() {
|
|||
shift
|
||||
command=$(IFS=-, ; echo "$*")
|
||||
|
||||
/usr/bin/man "$section" "$command"
|
||||
"$man" "$section" "$command"
|
||||
return $?
|
||||
elif [[ "$1" == -k ]]; then
|
||||
"$man" -k "$(IFS=-; echo "${*:2}")"
|
||||
return $?
|
||||
fi
|
||||
|
||||
|
@ -83,7 +87,7 @@ man() {
|
|||
if [[ "$command" =~ \. ]] && "$manpy" "$command" &>/dev/null; then
|
||||
"$manpy" "$command"
|
||||
elif /usr/bin/man "$command" >/dev/null 2>&1; then
|
||||
/usr/bin/man "$command"
|
||||
"$man" "$command"
|
||||
elif command -v "$command" &>/dev/null; then
|
||||
"$command" --help | nvim -R -c 'set syn=man' --
|
||||
elif command -v "$@" &>/dev/null; then
|
||||
|
|
Loading…
Reference in a new issue