Created
August 15, 2016 21:50
-
-
Save cocoalabs/2fb7dc2199b0d4bf160364b8e557eb66 to your computer and use it in GitHub Desktop.
Color Terminal for bash/zsh etc..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") \ | |
man "$@" | |
} |
Shorter… (no printf calls)
man() {
LESS_TERMCAP_mb=$'\e'"[1;31m" \
LESS_TERMCAP_md=$'\e'"[1;31m" \
LESS_TERMCAP_me=$'\e'"[0m" \
LESS_TERMCAP_se=$'\e'"[0m" \
LESS_TERMCAP_so=$'\e'"[1;44;33m" \
LESS_TERMCAP_ue=$'\e'"[0m" \
LESS_TERMCAP_us=$'\e'"[1;32m" \
command man "$@"
}
👍
or you can add the following to your ~/.profile and not override default commands - they're just environment variables anyway
export LESS_TERMCAP_mb=$'\e'"[1;31m"
export LESS_TERMCAP_md=$'\e'"[1;31m"
export LESS_TERMCAP_me=$'\e'"[0m"
export LESS_TERMCAP_se=$'\e'"[0m"
export LESS_TERMCAP_so=$'\e'"[1;44;33m"
export LESS_TERMCAP_ue=$'\e'"[0m"
export LESS_TERMCAP_us=$'\e'"[1;32m"
If you are using oh-my-zsh – you can achieve the same via colored-man-pages
plugin: https://github.com/robbyrussell/oh-my-zsh/blob/master/plugins/colored-man-pages/colored-man-pages.plugin.zsh
I've just tried on Fedora, and it seems not to work :(
Tnx @forkbomber!! I totally missed this when looking over oh-my-zsh plugins.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Awesome 👍