2156b4c08134e3918af78038416c407e4b28dbf6
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- GitHub <noreply@github.com>
- Date
Message
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.
Diff
1diff --git a/plugins/colored-man-pages/README.md b/plugins/colored-man-pages/README.md
2new file mode 100644
3index 0000000000000000000000000000000000000000..d9f6acb2a0fa1dcf8495f40ce0e6c612c3b294ba
4--- /dev/null
5+++ b/plugins/colored-man-pages/README.md
6@@ -0,0 +1,15 @@
7+# Colored man pages plugin
8+
9+This plugin adds colors to man pages.
10+
11+To use it, add `colored-man-pages` to the plugins array in your zshrc file:
12+
13+```zsh
14+plugins=(... colored-man-pages)
15+```
16+
17+You can also try to color other pages by prefixing the respective command with `colored`:
18+
19+```zsh
20+colored git help clone
21+```
22diff --git a/plugins/colored-man-pages/colored-man-pages.plugin.zsh b/plugins/colored-man-pages/colored-man-pages.plugin.zsh
23index 1bea536e021c5495e710a164a385b57ee87961c1..ac6a94654ddb6a96c7cc0b31db7d99e8efe6be10 100644
24--- a/plugins/colored-man-pages/colored-man-pages.plugin.zsh
25+++ b/plugins/colored-man-pages/colored-man-pages.plugin.zsh
26@@ -16,7 +16,7 @@ EOF
27 fi
28 fi
29
30-function man() {
31+function colored() {
32 env \
33 LESS_TERMCAP_mb=$(printf "\e[1;31m") \
34 LESS_TERMCAP_md=$(printf "\e[1;31m") \
35@@ -28,5 +28,9 @@ function man() {
36 PAGER="${commands[less]:-$PAGER}" \
37 _NROFF_U=1 \
38 PATH="$HOME/bin:$PATH" \
39- man "$@"
40+ "$@"
41+}
42+
43+function man() {
44+ colored man "$@"
45 }