Add zsh/oh my zsh/w10k
This commit is contained in:
15
zsh/.oh-my-zsh/plugins/colored-man-pages/README.md
Normal file
15
zsh/.oh-my-zsh/plugins/colored-man-pages/README.md
Normal file
@ -0,0 +1,15 @@
|
||||
# Colored man pages plugin
|
||||
|
||||
This plugin adds colors to man pages.
|
||||
|
||||
To use it, add `colored-man-pages` to the plugins array in your zshrc file:
|
||||
|
||||
```zsh
|
||||
plugins=(... colored-man-pages)
|
||||
```
|
||||
|
||||
You can also try to color other pages by prefixing the respective command with `colored`:
|
||||
|
||||
```zsh
|
||||
colored git help clone
|
||||
```
|
@ -0,0 +1,36 @@
|
||||
if [[ "$OSTYPE" = solaris* ]]
|
||||
then
|
||||
if [[ ! -x "$HOME/bin/nroff" ]]
|
||||
then
|
||||
mkdir -p "$HOME/bin"
|
||||
cat > "$HOME/bin/nroff" <<EOF
|
||||
#!/bin/sh
|
||||
if [ -n "\$_NROFF_U" -a "\$1,\$2,\$3" = "-u0,-Tlp,-man" ]; then
|
||||
shift
|
||||
exec /usr/bin/nroff -u\$_NROFF_U "\$@"
|
||||
fi
|
||||
#-- Some other invocation of nroff
|
||||
exec /usr/bin/nroff "\$@"
|
||||
EOF
|
||||
chmod +x "$HOME/bin/nroff"
|
||||
fi
|
||||
fi
|
||||
|
||||
function colored() {
|
||||
command 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") \
|
||||
PAGER="${commands[less]:-$PAGER}" \
|
||||
_NROFF_U=1 \
|
||||
PATH="$HOME/bin:$PATH" \
|
||||
"$@"
|
||||
}
|
||||
|
||||
function man() {
|
||||
colored man "$@"
|
||||
}
|
Reference in New Issue
Block a user