forked from ohmyzsh/ohmyzsh
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ohmyzsh#1574 from adben/master
updated theme adben
- Loading branch information
Showing
1 changed file
with
120 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,121 @@ | ||
#!/usr/bin/env zsh | ||
local USER_HOST='%{$terminfo[bold]$fg[yellow]%}%n@%m%{$reset_color%}' | ||
local RETURN_CODE="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" | ||
local GIT_BRANCH='%{$terminfo[bold]$fg[red]%}$(git_prompt_info)%{$reset_color%}' | ||
local CURRENT_DIR='%{$terminfo[bold]$fg[green]%} %~%{$reset_color%}' | ||
local RUBY_RVM='%{$fg[gray]%}‹$(rvm-prompt i v g)›%{$reset_color%}' | ||
local COMMAND_TIP='%{$terminfo[bold]$fg[blue]%}$(wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d' | sed 's/^/║/g')%{$reset_color%}' | ||
######### PROMPT ######### | ||
PROMPT="%{$terminfo[bold]$fg[blue]%}╔═ %{$reset_color%}${USER_HOST} ${CURRENT_DIR} ${RUBY_RVM} ${GIT_BRANCH} | ||
${COMMAND_TIP} | ||
%{$terminfo[bold]$fg[blue]%}╚═ %{$reset_color%}%B%{$terminfo[bold]$fg[white]%}$%b%{$reset_color%} " | ||
RPS1='${RETURN_CODE}' | ||
RPROMPT='%{$fg[green]%}[%*]%{$reset_color%}' | ||
######### PROMPT ######### | ||
########## GIT ########### | ||
ZSH_THEME_GIT_PROMPT_PREFIX="‹" | ||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$GIT_PROMPT_INFO%}›" | ||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$GIT_DIRTY_COLOR%}✘" | ||
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$GIT_CLEAN_COLOR%}✔" | ||
ZSH_THEME_GIT_PROMPT_ADDED="%{$FG[082]%}✚%{$reset_color%}" | ||
ZSH_THEME_GIT_PROMPT_MODIFIED="%{$FG[166]%}✹%{$reset_color%}" | ||
ZSH_THEME_GIT_PROMPT_DELETED="%{$FG[160]%}✖%{$reset_color%}" | ||
ZSH_THEME_GIT_PROMPT_RENAMED="%{$FG[220]%}➜%{$reset_color%}" | ||
ZSH_THEME_GIT_PROMPT_UNMERGED="%{$FG[082]%}═%{$reset_color%}" | ||
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$FG[190]%}✭%{$reset_color%}" | ||
########## GIT ########### | ||
# # | ||
# # #README | ||
# # | ||
# # This theme provides two customizable header functionalities : | ||
# # a) displaying a pseudo-random message from a database of quotations | ||
# # (https://en.wikipedia.org/wiki/Fortune_%28Unix%29) | ||
# # b) displaying randomly command line tips from The command line fu | ||
# # (http://www.commandlinefu.com) community: in order to make use of this functionality | ||
# # you will need Internet connection. | ||
# # This theme provides as well information for the current user's context, like; | ||
# # branch and status for the current version control system (git and svn currently | ||
# # supported) and time, presented to the user in a non invasive volatile way. | ||
# # | ||
# # #REQUIREMENTS | ||
# # This theme requires wget:: | ||
# # -Homebrew-osx- brew install wget | ||
# # -Debian/Ubuntu- apt-get install wget | ||
# # and fortune :: | ||
# # -Homebrew-osx- brew install fortune | ||
# # -Debian/Ubuntu- apt-get install fortune | ||
# # | ||
# # optionally: | ||
# # -Oh-myzsh vcs plug-ins git and svn. | ||
# # -Solarized theme (https://github.com/altercation/solarized/) | ||
# # -OS X: iTerm 2 (http://www.iterm2.com/) | ||
# # -font Source code pro (https://github.com/adobe/source-code-pro) | ||
# # | ||
# # Author: Adolfo Benedetti | ||
# # email: adolfo.benedetti@gmail.com | ||
# # License: Public Domain | ||
# # This theme's look and feel is based on the Aaron Toponce's zsh theme , more info: | ||
# # http://pthree.org/2008/11/23/727/ | ||
# # enjoy! | ||
########## COLOR ########### | ||
for COLOR in CYAN WHITE YELLOW MAGENTA BLACK BLUE RED DEFAULT GREEN GREY; do | ||
eval PR_$COLOR='%{$fg[${(L)COLOR}]%}' | ||
eval PR_BRIGHT_$COLOR='%{$fg_bold[${(L)COLOR}]%}' | ||
done | ||
PR_RESET="%{$reset_color%}" | ||
RED_START="${PR_RESET}${PR_GREY}<${PR_RESET}${PR_RED}<${PR_BRIGHT_RED}<${PR_RESET} " | ||
RED_END="${PR_RESET}${PR_BRIGHT_RED}>${PR_RESET}${PR_RED}>${PR_GREY}>${PR_RESET} " | ||
GREEN_END="${PR_RESET}${PR_BRIGHT_GREEN}>${PR_RESET}${PR_GREEN}>${PR_GREY}>${PR_RESET} " | ||
GREEN_BASE_START="${PR_RESET}${PR_GREY}>${PR_RESET}${PR_GREEN}>${PR_BRIGHT_GREEN}>${PR_RESET}" | ||
GREEN_START_P1="${PR_RESET}${GREEN_BASE_START}${PR_RESET} " | ||
DIVISION="${PR_RESET}${PR_RED} < ${PR_RESET}" | ||
VCS_DIRTY_COLOR="${PR_RESET}${PR_YELLOW}" | ||
Vcs_CLEAN_COLOR="${PR_RESET}${PR_GREEN}" | ||
VCS_SUFIX_COLOR="${PR_RESET}${PR_RED}› ${PR_RESET}" | ||
# ########## COLOR ########### | ||
# ########## SVN ########### | ||
ZSH_THEME_SVN_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹svn:" | ||
ZSH_THEME_SVN_PROMPT_SUFFIX="" | ||
ZSH_THEME_SVN_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" | ||
ZSH_THEME_SVN_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" | ||
# ########## SVN ########### | ||
# ########## GIT ########### | ||
ZSH_THEME_GIT_PROMPT_PREFIX="${PR_RESET}${PR_RED}‹git:" | ||
ZSH_THEME_GIT_PROMPT_SUFFIX="" | ||
ZSH_THEME_GIT_PROMPT_DIRTY="${VCS_DIRTY_COLOR} ✘${VCS_SUFIX_COLOR}" | ||
ZSH_THEME_GIT_PROMPT_CLEAN="${VCS_CLEAN_COLOR} ✔${VCS_SUFIX_COLOR}" | ||
ZSH_THEME_GIT_PROMPT_ADDED="${PR_RESET}${PR_YELLOW} ✚${PR_RESET}" | ||
ZSH_THEME_GIT_PROMPT_MODIFIED="${PR_RESET}${PR_YELLOW} ✹${PR_RESET}" | ||
ZSH_THEME_GIT_PROMPT_DELETED="${PR_RESET}${PR_YELLOW} ✖${PR_RESET}" | ||
ZSH_THEME_GIT_PROMPT_RENAMED="${PR_RESET}${PR_YELLOW} ➜${PR_RESET}" | ||
ZSH_THEME_GIT_PROMPT_UNMERGED="${PR_RESET}${PR_YELLOW} ═${PR_RESET}" | ||
ZSH_THEME_GIT_PROMPT_UNTRACKED="${PR_RESET}${PR_YELLOW} ✭${PR_RESET}" | ||
# ########## GIT ########### | ||
function precmd { | ||
#gets the fortune | ||
ps1_fortune () { | ||
#Choose from all databases, regardless of whether they are considered "offensive" | ||
fortune -a | ||
} | ||
#obtains the tip | ||
ps1_command_tip () { | ||
wget -qO - http://www.commandlinefu.com/commands/random/plaintext | sed 1d | sed '/^$/d' | ||
} | ||
prompt_header () { | ||
if [[ "true" == "$ENABLE_COMMAND_TIP" ]]; then | ||
ps1_command_tip | ||
else | ||
ps1_fortune | ||
fi | ||
} | ||
PROMPT_HEAD="${RED_START}${PR_YELLOW}$(prompt_header)${PR_RESET}" | ||
# set a simple variable to show when in screen | ||
if [[ -n "${WINDOW}" ]]; then | ||
SCREEN="" | ||
fi | ||
} | ||
|
||
# Context: user@directory or just directory | ||
prompt_context () { | ||
local user=`whoami` | ||
if [[ "$user" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then | ||
echo -n "${PR_RESET}${PR_RED}$user@%m${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" | ||
else | ||
echo -n "${PR_RESET}${PR_BRIGHT_YELLOW}%~%<<${PR_RESET}" | ||
fi | ||
} | ||
|
||
set_prompt () { | ||
# required for the prompt | ||
setopt prompt_subst | ||
autoload colors zsh/terminfo | ||
if [[ "$terminfo[colors]" -gt 8 ]]; then | ||
colors | ||
fi | ||
|
||
# ######### PROMPT ######### | ||
PROMPT='${PROMPT_HEAD} | ||
${RED_START}$(prompt_context) | ||
${GREEN_START_P1}' | ||
RPROMPT='${PR_RESET}$(git_prompt_info)$(svn_prompt_info)${PR_YELLOW}%D{%R.%S %a %b %d %Y} ${GREEN_END}${PR_RESET}' | ||
# Matching continuation prompt | ||
PROMPT2='${GREEN_BASE_START}${PR_RESET} %_ ${GREEN_BASE_START}${PR_RESET} ' | ||
# ######### PROMPT ######### | ||
} | ||
|
||
set_prompt |