-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathman
More file actions
68 lines (58 loc) · 3.01 KB
/
man
File metadata and controls
68 lines (58 loc) · 3.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# ALL the OSX man directories...
MANPATH=/usr/share/man:/usr/local/share/man:/usr/local/man:/Library/Developer/CommandLineTools/usr/share/man:/usr/local/MacGPG2/share/man:/Library/Java/JavaVirtualMachines/jdk1.8.0_66.jdk/Contents/Home/man:/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/man:/System/Library/Frameworks/JavaVM.framework/Versions/A/Resources/Documentation/man
export MANPATH
function _hman()
{
manpage=$*
if [ -z "$manpage" ] ; then
echo "Usage: hman man-page"
echo " - requires an argument, man page to view!"
return 1
fi
export LESS_TERMCAP_mb=$(printf "\e[1;31m") LESS_TERMCAP_md=$(printf "\e[1;31m") LESS_TERMCAP_me=$(printf "\e[0m") LESS_TERMCAP_se=$(printf "\e[0m") LESS_TERMCAP_so=$(printf "\e[1;44;33m") LESS_TERMCAP_ue=$(printf "\e[0m") LESS_TERMCAP_us=$(printf "\e[1;32m")
PAGER="col -b | open -a /Applications/Google\ Chrome.app -f" man $manpage
return $?
}
function hman()
{
manpage=$*
echo "man $manpage.."
if [ -z "$manpage" ] ; then
echo "Usage: hman man-page"
echo " - requires an argument, man page to view!"
return 1
fi
# export LESS_TERMCAP_mb=$(printf "\e[1;31m") LESS_TERMCAP_md=$(printf "\e[1;31m") LESS_TERMCAP_me=$(printf "\e[0m") LESS_TERMCAP_se=$(printf "\e[0m") LESS_TERMCAP_so=$(printf "\e[1;44;33m") LESS_TERMCAP_ue=$(printf "\e[0m") LESS_TERMCAP_us=$(printf "\e[1;32m")
man $manpage | /usr/local/bin/man2html > /tmp/.$manpage.$$.html
open -a /Applications/Google\ Chrome.app "file:///tmp/.$manpage.$$.html"
( sleep 10 ; rm -f "/tmp/.$manpage.$$.html" ) &
return $?
}
## see ~/sh/colors - no need for below.
#man ()
#{
# env LESS_TERMCAP_mb=$(printf "\e[1;31m") LESS_TERMCAP_md=$(printf "\e[1;31m") LESS_TERMCAP_me=$(printf "\e[0m") LESS_TERMCAP_se=$(printf "\e[0m") LESS_TERMCAP_so=$(printf "\e[1;44;33m") LESS_TERMCAP_ue=$(printf "\e[0m") LESS_TERMCAP_us=$(printf "\e[1;32m") /usr/bin/man "$@"
#}
function sman() { open -a /Applications/Safari.app man://$@ ; }
function pdfman() { man -t $@ | open -f -a Preview.app ; }
function xman() {
export LESS_TERMCAP_mb=$(tput bold; tput setaf 2) # green
export LESS_TERMCAP_md=$(tput bold; tput setaf 45) # cyan
export LESS_TERMCAP_me=$(tput sgr0)
export LESS_TERMCAP_so=$(tput bold; tput setaf 3; tput setab 4) # yellow on blue
export LESS_TERMCAP_se=$(tput rmso; tput sgr0)
export LESS_TERMCAP_us=$(tput smul; tput bold; tput setaf 190) # white
export LESS_TERMCAP_ue=$(tput rmul; tput sgr0)
export LESS_TERMCAP_mr=$(tput rev)
export LESS_TERMCAP_mh=$(tput dim)
export LESS_TERMCAP_ZN=$(tput ssubm)
export LESS_TERMCAP_ZV=$(tput rsubm)
export LESS_TERMCAP_ZO=$(tput ssupm)
export LESS_TERMCAP_ZW=$(tput rsupm)
open x-man-page://$@
}
eg ()
{
MAN_KEEP_FORMATTING=1 man "$@" 2> /dev/null | gsed --quiet --expression='/^E\(\x08.\)X\(\x08.\)\?A\(\x08.\)\?M\(\x08.\)\?P\(\x08.\)\?L\(\x08.\)\?E/{:a;p;n;/^[^ ]/q;ba}' | ${MANPAGER:-${PAGER:-pager -s}}
}
# vim:ts=4:sts=4:ai:et:syntax=bash:ft=bash: