mirror of https://github.com/ohmyzsh/ohmyzsh.git
colored-man-pages: add option to color any help command (#7173)
This allows you to use `colored git log --help` for example, to get colored output.pull/8065/head
commit
2156b4c081
|
@ -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
|
||||||
|
```
|
|
@ -16,7 +16,7 @@ EOF
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function man() {
|
function colored() {
|
||||||
env \
|
env \
|
||||||
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
LESS_TERMCAP_mb=$(printf "\e[1;31m") \
|
||||||
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
LESS_TERMCAP_md=$(printf "\e[1;31m") \
|
||||||
|
@ -28,5 +28,9 @@ function man() {
|
||||||
PAGER="${commands[less]:-$PAGER}" \
|
PAGER="${commands[less]:-$PAGER}" \
|
||||||
_NROFF_U=1 \
|
_NROFF_U=1 \
|
||||||
PATH="$HOME/bin:$PATH" \
|
PATH="$HOME/bin:$PATH" \
|
||||||
man "$@"
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
function man() {
|
||||||
|
colored man "$@"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue