diff --git a/bash/.bash_functions b/bash/.bash_functions index 0073039..526d606 100644 --- a/bash/.bash_functions +++ b/bash/.bash_functions @@ -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