mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-27 03:05:39 +01:00
Merge 5a1142315a into 96e4e5dd03
This commit is contained in:
commit
83b42b46d0
2 changed files with 50 additions and 45 deletions
|
|
@ -58,7 +58,7 @@ alias rn='rake notes'
|
||||||
alias rr='rake routes'
|
alias rr='rake routes'
|
||||||
|
|
||||||
# legacy stuff
|
# legacy stuff
|
||||||
alias ss='thin --stats "/thin/stats" start'
|
alias sstat='thin --stats "/thin/stats" start'
|
||||||
alias sg='ruby script/generate'
|
alias sg='ruby script/generate'
|
||||||
alias sd='ruby script/destroy'
|
alias sd='ruby script/destroy'
|
||||||
alias sp='ruby script/plugin'
|
alias sp='ruby script/plugin'
|
||||||
|
|
|
||||||
|
|
@ -1,44 +1,49 @@
|
||||||
# reference colors
|
# Michele Bologna's theme
|
||||||
GREEN="%{$fg_bold[green]%}"
|
# http://michelebologna.net
|
||||||
RED="%{$fg_bold[red]%}"
|
#
|
||||||
CYAN="%{$fg_bold[cyan]%}"
|
# This a theme for oh-my-zsh. Features a colored prompt with a right prompt
|
||||||
YELLOW="%{$fg_bold[yellow]%}"
|
# containing the git status (if applicable).
|
||||||
BLUE="%{$fg_bold[blue]%}"
|
# The '%' prompt will be green if last command return value is 0, yellow otherwise.
|
||||||
MAGENTA="%{$fg_bold[magenta]%}"
|
# The hostname color is based on hostname characters (see below).
|
||||||
WHITE="%{$fg_bold[white]%}"
|
# When using as root, the left prompt shows only the hostname in red color.
|
||||||
|
#
|
||||||
|
|
||||||
COLOR_ARRAY=($GREEN $RED $CYAN $YELLOW $BLUE $MAGENTA $WHITE)
|
local green="%{$fg_bold[green]%}"
|
||||||
|
local red="%{$fg_bold[red]%}"
|
||||||
|
local cyan="%{$fg_bold[cyan]%}"
|
||||||
|
local yellow="%{$fg_bold[yellow]%}"
|
||||||
|
local blue="%{$fg_bold[blue]%}"
|
||||||
|
local magenta="%{$fg_bold[magenta]%}"
|
||||||
|
local white="%{$fg_bold[white]%}"
|
||||||
|
local reset="%{$reset_color%}"
|
||||||
|
|
||||||
# color reset
|
local color_array
|
||||||
RESET_COLOR="%{$reset_color%}"
|
color_array=($green $red $cyan $yellow $blue $magenta $white)
|
||||||
|
|
||||||
# which color should be applied?
|
local username_normal_color=$white
|
||||||
USERNAME_NORMAL_COLOR=$WHITE
|
local username_root_color=$red
|
||||||
USERNAME_ROOT_COLOR=$RED
|
local hostname_root_color=$red
|
||||||
HOSTNAME_NORMAL_COLOR=$BLUE
|
|
||||||
# uncomment next line if you want auto-generated hostname color
|
|
||||||
#for i in `hostname`; HOSTNAME_NORMAL_COLOR=$COLOR_ARRAY[$[((#i))%7+1]]
|
|
||||||
HOSTNAME_ROOT_COLOR=$RED
|
|
||||||
HOSTNAME_COLOR=%(!.$HOSTNAME_ROOT_COLOR.$HOSTNAME_NORMAL_COLOR)
|
|
||||||
CURRENT_DIR_COLOR=$CYAN
|
|
||||||
|
|
||||||
# zsh commands
|
# calculating the hostname color with hostname characters
|
||||||
USERNAME_COMMAND="%n"
|
for i in `hostname`; local hostname_normal_color=$color_array[$[((#i))%7+1]]
|
||||||
HOSTNAME_COMMAND="%m"
|
|
||||||
CURRENT_DIR="%~"
|
|
||||||
|
|
||||||
# output: colors + commands
|
local hostname_color
|
||||||
USERNAME_OUTPUT="%(!..$USERNAME_NORMAL_COLOR$USERNAME_COMMAND$RESET_COLOR@)"
|
hostname_color=%(!.$hostname_root_color.$hostname_normal_color)
|
||||||
HOSTNAME_OUTPUT="$HOSTNAME_COLOR$HOSTNAME_COMMAND$RESET_COLOR"
|
local current_dir_color=$cyan
|
||||||
CURRENT_DIR_OUTPUT="$CURRENT_DIR_COLOR$CURRENT_DIR"
|
|
||||||
LAST_COMMAND_OUTPUT="%(?.%(!.$RED.$GREEN).$YELLOW)"
|
|
||||||
|
|
||||||
# git theming
|
local username_command="%n"
|
||||||
ZSH_THEME_GIT_PROMPT_PREFIX="("
|
local hostname_command="%m"
|
||||||
ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
local current_dir="%~"
|
||||||
ZSH_THEME_GIT_PROMPT_DIRTY=")$RED*"
|
|
||||||
ZSH_THEME_GIT_PROMPT_CLEAN=")"
|
|
||||||
|
|
||||||
# wrap all together
|
local username_output="%(!..$username_normal_color$username_command$reset@)"
|
||||||
PROMPT='$USERNAME_OUTPUT$HOSTNAME_OUTPUT:$CURRENT_DIR_OUTPUT $LAST_COMMAND_OUTPUT%#$RESET_COLOR '
|
local hostname_output="$hostname_color$hostname_command$reset"
|
||||||
RPROMPT='%1(j.fg: [%j].) $GREEN$(git_prompt_info)$RESET_COLOR [%@]'
|
local current_dir_output="$current_dir_color$current_dir"
|
||||||
|
local last_command_output="%(?.%(!.$red.$green).$yellow)"
|
||||||
|
|
||||||
|
export ZSH_THEME_GIT_PROMPT_PREFIX="("
|
||||||
|
export ZSH_THEME_GIT_PROMPT_SUFFIX=""
|
||||||
|
export ZSH_THEME_GIT_PROMPT_DIRTY=")$red*"
|
||||||
|
export ZSH_THEME_GIT_PROMPT_CLEAN=")"
|
||||||
|
|
||||||
|
export PROMPT='$username_output$hostname_output:$current_dir_output $last_command_output%#$reset '
|
||||||
|
export RPROMPT='%1(j.fg: [%j].) $green$(git_prompt_info)$reset [%@]'
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue