-
-
Notifications
You must be signed in to change notification settings - Fork 673
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
colored_man_pages: Update to use local variables
- Loading branch information
Showing
2 changed files
with
46 additions
and
12 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,41 @@ | ||
#! bash oh-my-bash.module | ||
# | ||
# Colored Man Pages Plugin | ||
# | ||
# This plugin is based on the following Oh-My-Zsh plugin: | ||
# https://github.com/ohmyzsh/ohmyzsh/blob/6bc4c80c7db072a0d2d265eb3589bbe52e0d2737/plugins/colored-man-pages/colored-man-pages.plugin.zsh | ||
|
||
# Bold and Blinking | ||
export LESS_TERMCAP_mb=$_omb_term_green | ||
export LESS_TERMCAP_md=$_omb_term_bold_green | ||
export LESS_TERMCAP_me=$_omb_term_reset | ||
# Adds the LESS_TERMCAP_* variables to the environment to color man pages. | ||
function colored() { | ||
local -a environment | ||
|
||
# Standout Mode | ||
export LESS_TERMCAP_so=$_omb_term_olive | ||
export LESS_TERMCAP_se=$_omb_term_reset | ||
environment+=( LESS_TERMCAP_mb=${_omb_term_red} ) | ||
environment+=( LESS_TERMCAP_md=${_omb_term_bold_red} ) | ||
environment+=( LESS_TERMCAP_me=${_omb_term_reset} ) | ||
environment+=( LESS_TERMCAP_so=${_omb_term_bold_yellow} ) | ||
environment+=( LESS_TERMCAP_se=${_omb_term_reset} ) | ||
environment+=( LESS_TERMCAP_us=${_omb_term_bold_green} ) | ||
environment+=( LESS_TERMCAP_ue=${_omb_term_reset} ) | ||
|
||
# Underline | ||
export LESS_TERMCAP_us=$_omb_term_purple | ||
export LESS_TERMCAP_ue=$_omb_term_reset | ||
# Prefer `less` whenever available, since we specifically configured | ||
# environment for it. | ||
environment+=( PAGER="${commands[less]:-$PAGER}" ) | ||
environment+=( GROFF_NO_SGR=1 ) | ||
|
||
# Extra Styles | ||
env "${environment[@]}" "$@" | ||
} | ||
|
||
# Wrapper for man to colorize the output. | ||
function man { | ||
colored man "$@" | ||
} | ||
|
||
# Wrapper for dman to colorize the output. | ||
function dman { | ||
colored dman "$@" | ||
} | ||
|
||
# Wrapper for debman to colorize the output. | ||
function debman { | ||
colored debman "$@" | ||
} |