From 2d2425f704297365ca01b679cb3a892908b5214b Mon Sep 17 00:00:00 2001 From: Jonathan Hodgson Date: Sat, 4 Jan 2020 13:26:59 +0000 Subject: [PATCH] Adds new man function --- shells/shared/functions | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/shells/shared/functions b/shells/shared/functions index 93004b4f..47b86553 100644 --- a/shells/shared/functions +++ b/shells/shared/functions @@ -299,3 +299,15 @@ function proxy_off(){ HTTP_PROXY HTTPS_PROXY FTP_PROXY RSYNC_PROXY echo -e "Proxy environment variable removed." } + +function man(){ + MAN="/usr/bin/man" + if [ -n "$1" ]; then + $MAN "$@" + return $? + else + $MAN -k . | fzf --reverse --preview="echo {1,2} | sed 's/ (/./' | sed -E 's/\)\s*$//' | xargs $MAN" | awk '{print $1 "." $2}' | tr -d '()' | xargs -r "$MAN" + return $? + fi +} +#alias man="myman"