diff options
Diffstat (limited to 'themes')
-rw-r--r-- | themes/af-magic.zsh-theme | 2 | ||||
-rw-r--r-- | themes/agnoster.zsh-theme | 26 | ||||
-rw-r--r-- | themes/avit.zsh-theme | 23 | ||||
-rw-r--r-- | themes/bira.zsh-theme | 17 | ||||
-rw-r--r-- | themes/bureau.zsh-theme | 54 | ||||
-rw-r--r-- | themes/candy.zsh-theme | 2 | ||||
-rw-r--r-- | themes/dogenpunk.zsh-theme | 2 | ||||
-rw-r--r-- | themes/half-life.zsh-theme | 2 | ||||
-rw-r--r-- | themes/kennethreitz.zsh-theme | 8 | ||||
-rw-r--r-- | themes/muse.zsh-theme | 7 | ||||
-rw-r--r-- | themes/nebirhos.zsh-theme | 2 | ||||
-rw-r--r-- | themes/peepcode.zsh-theme | 2 | ||||
-rw-r--r-- | themes/pure.zsh-theme | 110 | ||||
-rw-r--r-- | themes/refined.zsh-theme | 106 | ||||
-rw-r--r-- | themes/rkj-repos.zsh-theme | 6 | ||||
-rw-r--r-- | themes/robbyrussell.zsh-theme | 10 | ||||
-rw-r--r-- | themes/steeef.zsh-theme | 2 | ||||
-rw-r--r-- | themes/sunrise.zsh-theme | 6 | ||||
-rw-r--r-- | themes/suvash.zsh-theme | 38 | ||||
-rw-r--r-- | themes/trapd00r.zsh-theme | 4 | ||||
-rw-r--r-- | themes/xiong-chiamiov-plus.zsh-theme | 2 | ||||
-rw-r--r-- | themes/xiong-chiamiov.zsh-theme | 2 | ||||
-rw-r--r-- | themes/ys.zsh-theme | 54 |
23 files changed, 274 insertions, 213 deletions
diff --git a/themes/af-magic.zsh-theme b/themes/af-magic.zsh-theme index 97d142a0f..1c6d1732c 100644 --- a/themes/af-magic.zsh-theme +++ b/themes/af-magic.zsh-theme @@ -27,7 +27,7 @@ else fi # git settings -ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075](branch:" +ZSH_THEME_GIT_PROMPT_PREFIX="$FG[075]($FG[078]" ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_DIRTY="$my_orange*%{$reset_color%}" ZSH_THEME_GIT_PROMPT_SUFFIX="$FG[075])%{$reset_color%}" diff --git a/themes/agnoster.zsh-theme b/themes/agnoster.zsh-theme index 103041eef..07546fd34 100644 --- a/themes/agnoster.zsh-theme +++ b/themes/agnoster.zsh-theme @@ -86,7 +86,7 @@ prompt_context() { # Git: branch/detached head, dirty status prompt_git() { - + (( $+commands[git] )) || return local PL_BRANCH_CHAR () { local LC_ALL="" LC_CTYPE="en_US.UTF-8" @@ -127,7 +127,30 @@ prompt_git() { fi } +prompt_bzr() { + (( $+commands[bzr] )) || return + if (bzr status >/dev/null 2>&1); then + status_mod=`bzr status | head -n1 | grep "modified" | wc -m` + status_all=`bzr status | head -n1 | wc -m` + revision=`bzr log | head -n2 | tail -n1 | sed 's/^revno: //'` + if [[ $status_mod -gt 0 ]] ; then + prompt_segment yellow black + echo -n "bzr@"$revision "✚ " + else + if [[ $status_all -gt 0 ]] ; then + prompt_segment yellow black + echo -n "bzr@"$revision + + else + prompt_segment green black + echo -n "bzr@"$revision + fi + fi + fi +} + prompt_hg() { + (( $+commands[hg] )) || return local rev status if $(hg id >/dev/null 2>&1); then if $(hg prompt >/dev/null 2>&1); then @@ -197,6 +220,7 @@ build_prompt() { prompt_context prompt_dir prompt_git + prompt_bzr prompt_hg prompt_end } diff --git a/themes/avit.zsh-theme b/themes/avit.zsh-theme index 65466b82f..4f0dcbcc6 100644 --- a/themes/avit.zsh-theme +++ b/themes/avit.zsh-theme @@ -2,16 +2,25 @@ PROMPT=' $(_user_host)${_current_dir} $(git_prompt_info) $(_ruby_version) -▶ ' +%{$fg[$CARETCOLOR]%}▶%{$resetcolor%} ' -PROMPT2='%{$fg[grey]%}◀%{$reset_color%} ' +PROMPT2='%{$fg[$CARETCOLOR]%}◀%{$reset_color%} ' RPROMPT='$(_vi_status)%{$(echotc UP 1)%}$(_git_time_since_commit) $(git_prompt_status) ${_return_status}%{$(echotc DO 1)%}' -local _current_dir="%{$fg[blue]%}%3~%{$reset_color%} " -local _return_status="%{$fg[red]%}%(?..⍉)%{$reset_color%}" +local _current_dir="%{$fg_bold[blue]%}%3~%{$reset_color%} " +local _return_status="%{$fg_bold[red]%}%(?..⍉)%{$reset_color%}" local _hist_no="%{$fg[grey]%}%h%{$reset_color%}" +function _current_dir() { + local _max_pwd_length="65" + if [[ $(echo -n $PWD | wc -c) -gt ${_max_pwd_length} ]]; then + echo "%{$fg_bold[blue]%}%-2~ ... %3~%{$reset_color%} " + else + echo "%{$fg_bold[blue]%}%~%{$reset_color%} " + fi +} + function _user_host() { if [[ -n $SSH_CONNECTION ]]; then me="%n@%m" @@ -32,6 +41,8 @@ function _vi_status() { function _ruby_version() { if {echo $fpath | grep -q "plugins/rvm"}; then echo "%{$fg[grey]%}$(rvm_prompt_info)%{$reset_color%}" + elif {echo $fpath | grep -q "plugins/rbenv"}; then + echo "%{$fg[grey]%}$(rbenv_prompt_info)%{$reset_color%}" fi } @@ -85,13 +96,13 @@ ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}⚑ " ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ " ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}▴ " ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ " -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[grey]%}◒ " +ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ " # Colors vary depending on time lapsed. ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[green]%}" ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}" ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}" -ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[grey]%}" +ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}" # LS colors, made with http://geoff.greer.fm/lscolors/ export LSCOLORS="exfxcxdxbxegedabagacad" diff --git a/themes/bira.zsh-theme b/themes/bira.zsh-theme index 215720477..29bda0be8 100644 --- a/themes/bira.zsh-theme +++ b/themes/bira.zsh-theme @@ -1,8 +1,16 @@ # ZSH Theme - Preview: http://gyazo.com/8becc8a7ed5ab54a0262a470555c3eed.png local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' -local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}' + +if [[ $UID -eq 0 ]]; then + local user_host='%{$terminfo[bold]$fg[red]%}%n@%m%{$reset_color%}' + local user_symbol='#' +else + local user_host='%{$terminfo[bold]$fg[green]%}%n@%m%{$reset_color%}' + local user_symbol='$' +fi + +local current_dir='%{$terminfo[bold]$fg[blue]%}%~%{$reset_color%}' local rvm_ruby='' if which rvm-prompt &> /dev/null; then rvm_ruby='%{$fg[red]%}‹$(rvm-prompt i v g)›%{$reset_color%}' @@ -14,8 +22,9 @@ fi local git_branch='$(git_prompt_info)%{$reset_color%}' PROMPT="╭─${user_host} ${current_dir} ${rvm_ruby} ${git_branch} -╰─%B$%b " -RPS1="${return_code}" +╰─%B${user_symbol}%b " +RPS1="%B${return_code}%b" ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[yellow]%}‹" ZSH_THEME_GIT_PROMPT_SUFFIX="› %{$reset_color%}" + diff --git a/themes/bureau.zsh-theme b/themes/bureau.zsh-theme index 148abec10..3b3bdc80f 100644 --- a/themes/bureau.zsh-theme +++ b/themes/bureau.zsh-theme @@ -22,34 +22,44 @@ bureau_git_branch () { echo "${ref#refs/heads/}" } -bureau_git_status () { - _INDEX=$(command git status --porcelain -b 2> /dev/null) +bureau_git_status() { _STATUS="" - if $(echo "$_INDEX" | grep '^[AMRD]. ' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" - fi - if $(echo "$_INDEX" | grep '^.[MTD] ' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" - fi - if $(echo "$_INDEX" | command grep -E '^\?\? ' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" - fi - if $(echo "$_INDEX" | grep '^UU ' &> /dev/null); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" - fi - if $(command git rev-parse --verify refs/stash >/dev/null 2>&1); then - _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" + + # check status of files + _INDEX=$(command git status --porcelain 2> /dev/null) + if [[ -n "$_INDEX" ]]; then + if $(echo "$_INDEX" | command grep -q '^[AMRD]. '); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STAGED" + fi + if $(echo "$_INDEX" | command grep -q '^.[MTD] '); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNSTAGED" + fi + if $(echo "$_INDEX" | command grep -q -E '^\?\? '); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNTRACKED" + fi + if $(echo "$_INDEX" | command grep -q '^UU '); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_UNMERGED" + fi + else + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_CLEAN" fi - if $(echo "$_INDEX" | grep '^## .*ahead' &> /dev/null); then + + # check status of local repository + _INDEX=$(command git status --porcelain -b 2> /dev/null) + if $(echo "$_INDEX" | command grep -q '^## .*ahead'); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_AHEAD" fi - if $(echo "$_INDEX" | grep '^## .*behind' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q '^## .*behind'); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_BEHIND" fi - if $(echo "$_INDEX" | grep '^## .*diverged' &> /dev/null); then + if $(echo "$_INDEX" | command grep -q '^## .*diverged'); then _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_DIVERGED" fi + if $(command git rev-parse --verify refs/stash &> /dev/null); then + _STATUS="$_STATUS$ZSH_THEME_GIT_PROMPT_STASHED" + fi + echo $_STATUS } @@ -84,10 +94,10 @@ _LIBERTY="$_LIBERTY%{$reset_color%}" get_space () { local STR=$1$2 local zero='%([BSUbfksu]|([FB]|){*})' - local LENGTH=${#${(S%%)STR//$~zero/}} + local LENGTH=${#${(S%%)STR//$~zero/}} local SPACES="" (( LENGTH = ${COLUMNS} - $LENGTH - 1)) - + for i in {0..$LENGTH} do SPACES="$SPACES " @@ -101,7 +111,7 @@ _1RIGHT="[%*] " bureau_precmd () { _1SPACES=`get_space $_1LEFT $_1RIGHT` - print + print print -rP "$_1LEFT$_1SPACES$_1RIGHT" } diff --git a/themes/candy.zsh-theme b/themes/candy.zsh-theme index bc125c5ce..40e6d411e 100644 --- a/themes/candy.zsh-theme +++ b/themes/candy.zsh-theme @@ -1,4 +1,4 @@ -PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%I:%M:%S]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ +PROMPT=$'%{$fg_bold[green]%}%n@%m %{$fg[blue]%}%D{[%X]} %{$reset_color%}%{$fg[white]%}[%~]%{$reset_color%} $(git_prompt_info)\ %{$fg[blue]%}->%{$fg_bold[blue]%} %#%{$reset_color%} ' ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}[" diff --git a/themes/dogenpunk.zsh-theme b/themes/dogenpunk.zsh-theme index d6719281d..6a9921288 100644 --- a/themes/dogenpunk.zsh-theme +++ b/themes/dogenpunk.zsh-theme @@ -37,7 +37,7 @@ ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[cyan]%}" function git_time_since_commit() { if git rev-parse --git-dir > /dev/null 2>&1; then # Only proceed if there is actually a commit. - if [[ $(git log 2>&1 > /dev/null | grep -c "^fatal: bad default revision") == 0 ]]; then + if git log -n 1 > /dev/null 2>&1; then # Get the last commit. last_commit=`git log --pretty=format:'%at' -1 2> /dev/null` now=`date +%s` diff --git a/themes/half-life.zsh-theme b/themes/half-life.zsh-theme index a3c505706..5f987099d 100644 --- a/themes/half-life.zsh-theme +++ b/themes/half-life.zsh-theme @@ -17,7 +17,7 @@ setopt prompt_subst autoload -U add-zsh-hook autoload -Uz vcs_info -#use extended color pallete if available +#use extended color palette if available if [[ $TERM = *256color* || $TERM = *rxvt* ]]; then turquoise="%F{81}" orange="%F{166}" diff --git a/themes/kennethreitz.zsh-theme b/themes/kennethreitz.zsh-theme index 109be0c22..b255a8d66 100644 --- a/themes/kennethreitz.zsh-theme +++ b/themes/kennethreitz.zsh-theme @@ -1,13 +1,15 @@ local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" -PROMPT='%{$fg[green]%}%c \ +PROMPT='$(virtualenv_prompt_info)%{[03m%}%{$fg[green]%}%c \ $(git_prompt_info)\ +\ %{$fg[red]%}%(!.#.»)%{$reset_color%} ' PROMPT2='%{$fg[red]%}\ %{$reset_color%}' RPS1='%{$fg[blue]%}%~%{$reset_color%} ${return_code} ' -ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}:: %{$fg[yellow]%}(" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$reset_color%}%{$fg[yellow]%}(" ZSH_THEME_GIT_PROMPT_SUFFIX=")%{$reset_color%} " ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[red]%}*%{$fg[yellow]%}" - +ZSH_THEME_VIRTUAL_ENV_PROMPT_PREFIX="%{$reset_color%}%{[03m%}%{$fg[blue]%}" +ZSH_THEME_VIRTUAL_ENV_PROMPT_SUFFIX="!%{$reset_color%} "
\ No newline at end of file diff --git a/themes/muse.zsh-theme b/themes/muse.zsh-theme index 4bd8fb825..c7cd9ee30 100644 --- a/themes/muse.zsh-theme +++ b/themes/muse.zsh-theme @@ -13,11 +13,11 @@ GIT_DIRTY_COLOR=$FG[133] GIT_CLEAN_COLOR=$FG[118] GIT_PROMPT_INFO=$FG[012] -PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%} %{$GIT_PROMPT_INFO%}$(git_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} ' +PROMPT='%{$PROMPT_SUCCESS_COLOR%}%~%{$reset_color%}%{$GIT_PROMPT_INFO%}$(git_prompt_info)$(virtualenv_prompt_info)%{$GIT_DIRTY_COLOR%}$(git_prompt_status) %{$reset_color%}%{$PROMPT_PROMPT%}ᐅ%{$reset_color%} ' #RPS1="${return_code}" -ZSH_THEME_GIT_PROMPT_PREFIX="(" +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%}✔" @@ -28,3 +28,6 @@ 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%}" + +ZSH_THEME_VIRTUALENV_PREFIX=" [" +ZSH_THEME_VIRTUALENV_SUFFIX="]" diff --git a/themes/nebirhos.zsh-theme b/themes/nebirhos.zsh-theme index a5a226b69..e2424465a 100644 --- a/themes/nebirhos.zsh-theme +++ b/themes/nebirhos.zsh-theme @@ -11,7 +11,7 @@ else fi # Get the host name (first 4 chars) -HOST_PROMPT_="%{$fg_bold[red]%}@$HOST[0,4] ➜ %{$fg_bold[cyan]%}%c " +HOST_PROMPT_="%{$fg_bold[red]%}@$HOST ➜ %{$fg_bold[cyan]%}%c " GIT_PROMPT="%{$fg_bold[blue]%}\$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}" PROMPT="$HOST_PROMPT_$RUBY_PROMPT_$GIT_PROMPT" diff --git a/themes/peepcode.zsh-theme b/themes/peepcode.zsh-theme index 96e4f1192..b6dfa6870 100644 --- a/themes/peepcode.zsh-theme +++ b/themes/peepcode.zsh-theme @@ -41,4 +41,4 @@ PROMPT=' %~ ${smiley} %{$reset_color%}' -RPROMPT='%{$fg[white]%} $(~/.rvm/bin/rvm-prompt)$(git_prompt)%{$reset_color%}' +RPROMPT='%{$fg[white]%} $(ruby_prompt_info)$(git_prompt)%{$reset_color%}' diff --git a/themes/pure.zsh-theme b/themes/pure.zsh-theme index 1473194a5..98c1312af 100644 --- a/themes/pure.zsh-theme +++ b/themes/pure.zsh-theme @@ -1,106 +1,10 @@ -#!/usr/bin/env zsh +print -P '%F{yellow}'Oh My Zsh pure theme: +cat <<-EOF -# ------------------------------------------------------------------------------ -# -# Pure - A minimal and beautiful theme for oh-my-zsh -# -# Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge -# thanks goes out to him for designing the fantastic Pure prompt in the first -# place! I'd also like to thank Julien Nicoulaud for his "nicoulaj" theme from -# which I've borrowed both some ideas and some actual code. You can find out -# more about both of these fantastic two people here: -# -# Sindre Sorhus -# Github: https://github.com/sindresorhus -# Twitter: https://twitter.com/sindresorhus -# -# Julien Nicoulaud -# Github: https://github.com/nicoulaj -# Twitter: https://twitter.com/nicoulaj -# -# ------------------------------------------------------------------------------ + The pure theme has been renamed as 'refined' as per the original author's + request. Change your ZSH_THEME to 'refined' to avoid seeing this warning. -# Set required options -# -setopt prompt_subst +EOF +print -P '%f' -# Load required modules -# -autoload -Uz vcs_info - -# Set vcs_info parameters -# -zstyle ':vcs_info:*' enable hg bzr git -zstyle ':vcs_info:*:*' unstagedstr '!' -zstyle ':vcs_info:*:*' stagedstr '+' -zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c" -zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)" -zstyle ':vcs_info:*:*' nvcsformats "%~" "" "" - -# Fastest possible way to check if repo is dirty -# -git_dirty() { - # Check if we're in a git repo - command git rev-parse --is-inside-work-tree &>/dev/null || return - # Check if it's dirty - command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo "*" -} - -# Display information about the current repository -# -repo_information() { - echo "%F{blue}${vcs_info_msg_0_%%/.} %F{8}$vcs_info_msg_1_`git_dirty` $vcs_info_msg_2_%f" -} - -# Displays the exec time of the last command if set threshold was exceeded -# -cmd_exec_time() { - local stop=`date +%s` - local start=${cmd_timestamp:-$stop} - let local elapsed=$stop-$start - [ $elapsed -gt 5 ] && echo ${elapsed}s -} - -# Get the intial timestamp for cmd_exec_time -# -preexec() { - cmd_timestamp=`date +%s` -} - -# Output additional information about paths, repos and exec time -# -precmd() { - vcs_info # Get version control info before we start outputting stuff - print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" -} - -# Define prompts -# -PROMPT="%(?.%F{magenta}.%F{red})❯%f " # Display a red prompt char on failure -RPROMPT="%F{8}${SSH_TTY:+%n@%m}%f" # Display username if connected via SSH - -# ------------------------------------------------------------------------------ -# -# List of vcs_info format strings: -# -# %b => current branch -# %a => current action (rebase/merge) -# %s => current version control system -# %r => name of the root directory of the repository -# %S => current path relative to the repository root directory -# %m => in case of Git, show information about stashes -# %u => show unstaged changes in the repository -# %c => show staged changes in the repository -# -# List of prompt format strings: -# -# prompt: -# %F => color dict -# %f => reset color -# %~ => current path -# %* => time -# %n => username -# %m => shortname host -# %(?..) => prompt conditional - %(condition.true.false) -# -# ------------------------------------------------------------------------------ +source ${0:h:A}/refined.zsh-theme diff --git a/themes/refined.zsh-theme b/themes/refined.zsh-theme new file mode 100644 index 000000000..0e5681cc7 --- /dev/null +++ b/themes/refined.zsh-theme @@ -0,0 +1,106 @@ +#!/usr/bin/env zsh + +# ------------------------------------------------------------------------------ +# +# Pure - A minimal and beautiful theme for oh-my-zsh +# +# Based on the custom Zsh-prompt of the same name by Sindre Sorhus. A huge +# thanks goes out to him for designing the fantastic Pure prompt in the first +# place! I'd also like to thank Julien Nicoulaud for his "nicoulaj" theme from +# which I've borrowed both some ideas and some actual code. You can find out +# more about both of these fantastic two people here: +# +# Sindre Sorhus +# Github: https://github.com/sindresorhus +# Twitter: https://twitter.com/sindresorhus +# +# Julien Nicoulaud +# Github: https://github.com/nicoulaj +# Twitter: https://twitter.com/nicoulaj +# +# ------------------------------------------------------------------------------ + +# Set required options +# +setopt prompt_subst + +# Load required modules +# +autoload -Uz vcs_info + +# Set vcs_info parameters +# +zstyle ':vcs_info:*' enable hg bzr git +zstyle ':vcs_info:*:*' unstagedstr '!' +zstyle ':vcs_info:*:*' stagedstr '+' +zstyle ':vcs_info:*:*' formats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%%u%c" +zstyle ':vcs_info:*:*' actionformats "$FX[bold]%r$FX[no-bold]/%S" "%s/%b" "%u%c (%a)" +zstyle ':vcs_info:*:*' nvcsformats "%~" "" "" + +# Fastest possible way to check if repo is dirty +# +git_dirty() { + # Check if we're in a git repo + command git rev-parse --is-inside-work-tree &>/dev/null || return + # Check if it's dirty + command git diff --quiet --ignore-submodules HEAD &>/dev/null; [ $? -eq 1 ] && echo "*" +} + +# Display information about the current repository +# +repo_information() { + echo "%F{blue}${vcs_info_msg_0_%%/.} %F{8}$vcs_info_msg_1_`git_dirty` $vcs_info_msg_2_%f" +} + +# Displays the exec time of the last command if set threshold was exceeded +# +cmd_exec_time() { + local stop=`date +%s` + local start=${cmd_timestamp:-$stop} + let local elapsed=$stop-$start + [ $elapsed -gt 5 ] && echo ${elapsed}s +} + +# Get the initial timestamp for cmd_exec_time +# +preexec() { + cmd_timestamp=`date +%s` +} + +# Output additional information about paths, repos and exec time +# +precmd() { + vcs_info # Get version control info before we start outputting stuff + print -P "\n$(repo_information) %F{yellow}$(cmd_exec_time)%f" +} + +# Define prompts +# +PROMPT="%(?.%F{magenta}.%F{red})❯%f " # Display a red prompt char on failure +RPROMPT="%F{8}${SSH_TTY:+%n@%m}%f" # Display username if connected via SSH + +# ------------------------------------------------------------------------------ +# +# List of vcs_info format strings: +# +# %b => current branch +# %a => current action (rebase/merge) +# %s => current version control system +# %r => name of the root directory of the repository +# %S => current path relative to the repository root directory +# %m => in case of Git, show information about stashes +# %u => show unstaged changes in the repository +# %c => show staged changes in the repository +# +# List of prompt format strings: +# +# prompt: +# %F => color dict +# %f => reset color +# %~ => current path +# %* => time +# %n => username +# %m => shortname host +# %(?..) => prompt conditional - %(condition.true.false) +# +# ------------------------------------------------------------------------------ diff --git a/themes/rkj-repos.zsh-theme b/themes/rkj-repos.zsh-theme index a3f1f3dfa..ba2a0dba6 100644 --- a/themes/rkj-repos.zsh-theme +++ b/themes/rkj-repos.zsh-theme @@ -23,14 +23,14 @@ function mygit() { if [[ "$(git config --get oh-my-zsh.hide-status)" != "1" ]]; then ref=$(command git symbolic-ref HEAD 2> /dev/null) || \ ref=$(command git rev-parse --short HEAD 2> /dev/null) || return - echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_short_sha)$( git_prompt_status )%{$reset_color%}$ZSH_THEME_GIT_PROMPT_SUFFIX " + echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(git_prompt_short_sha)$(git_prompt_status)%{$fg_bold[blue]%}$ZSH_THEME_GIT_PROMPT_SUFFIX " fi } function retcode() {} # alternate prompt with git & hg -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} -%{\e[0;34m%}%B└─%B[%{\e[1;35m%}%?$(retcode)%{\e[0;34m%}%B] <$(mygit)$(hg_prompt_info)>%{\e[0m%}%b ' +PROMPT=$'%{$fg_bold[blue]%}┌─[%{$fg_bold[green]%}%n%b%{$fg[black]%}@%{$fg[cyan]%}%m%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%{$fg_bold[white]%}%~%{$fg_bold[blue]%}]%{$reset_color%} - %{$fg_bold[blue]%}[%b%{$fg[yellow]%}'%D{"%Y-%m-%d %I:%M:%S"}%b$'%{$fg_bold[blue]%}] +%{$fg_bold[blue]%}└─[%{$fg_bold[magenta]%}%?$(retcode)%{$fg_bold[blue]%}] <$(mygit)$(hg_prompt_info)>%{$reset_color%} ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/robbyrussell.zsh-theme b/themes/robbyrussell.zsh-theme index 24e1e8c52..f9eca6a87 100644 --- a/themes/robbyrussell.zsh-theme +++ b/themes/robbyrussell.zsh-theme @@ -1,7 +1,7 @@ -local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" -PROMPT='${ret_status}%{$fg_bold[green]%}%p %{$fg[cyan]%}%c %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}' +local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ )" +PROMPT='${ret_status} %{$fg[cyan]%}%c%{$reset_color%} $(git_prompt_info)' -ZSH_THEME_GIT_PROMPT_PREFIX="git:(%{$fg[red]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[blue]%}git:(%{$fg[red]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}) %{$fg[yellow]%}✗" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" diff --git a/themes/steeef.zsh-theme b/themes/steeef.zsh-theme index 13dc3ad2f..b72a41c92 100644 --- a/themes/steeef.zsh-theme +++ b/themes/steeef.zsh-theme @@ -19,7 +19,7 @@ setopt prompt_subst autoload -U add-zsh-hook autoload -Uz vcs_info -#use extended color pallete if available +#use extended color palette if available if [[ $terminfo[colors] -ge 256 ]]; then turquoise="%F{81}" orange="%F{166}" diff --git a/themes/sunrise.zsh-theme b/themes/sunrise.zsh-theme index 57d2649c6..e3f4019d6 100644 --- a/themes/sunrise.zsh-theme +++ b/themes/sunrise.zsh-theme @@ -10,9 +10,9 @@ B=$fg_no_bold[blue] RESET=$reset_color if [ "$USER" = "root" ]; then - PROMPTCOLOR="%{$R%}" PREFIX="-!-"; + PROMPTCOLOR="%{$R%}" PROMPTPREFIX="-!-"; else - PROMPTCOLOR="" PREFIX="---"; + PROMPTCOLOR="" PROMPTPREFIX="---"; fi local return_code="%(?..%{$R%}%? ↵%{$RESET%})" @@ -66,7 +66,7 @@ function custom_git_prompt() { } # %B sets bold text -PROMPT='%B$PREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} ' +PROMPT='%B$PROMPTPREFIX %2~ $(custom_git_prompt)%{$M%}%B»%b%{$RESET%} ' RPS1="${return_code}" ZSH_THEME_GIT_PROMPT_PREFIX="%{$Y%}‹" diff --git a/themes/suvash.zsh-theme b/themes/suvash.zsh-theme index c87f64558..1680973df 100644 --- a/themes/suvash.zsh-theme +++ b/themes/suvash.zsh-theme @@ -5,26 +5,30 @@ function prompt_char { } function virtualenv_info { - [ $VIRTUAL_ENV ] && echo '('`basename $VIRTUAL_ENV`') ' + [[ -n "$VIRTUAL_ENV" ]] && echo '('${VIRTUAL_ENV:t}') ' } -function collapse_pwd { - echo $(pwd | sed -e "s,^$HOME,~,") +function ruby_prompt { + if (( $+commands[rvm-prompt] )); then + print -n $ZSH_THEME_RUBY_PROMPT_PREFIX + print -n $(~/.rvm/bin/rvm-prompt) + print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX + elif (( $+commands[rbenv] )); then + print -n $ZSH_THEME_RUBY_PROMPT_PREFIX + print -n $(rbenv version | sed -e "s/ (set.*$//") + print -n $ZSH_THEME_RUBY_PROMPT_SUFFIX + fi + return 0 } -if which rvm-prompt &> /dev/null; then - PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(~/.rvm/bin/rvm-prompt)%{$reset_color%} -$(virtualenv_info)$(prompt_char) ' -else - if which rbenv &> /dev/null; then - PROMPT='%{$fg[magenta]%}%n%{$reset_color%} at %{$fg[yellow]%}%m%{$reset_color%} in %{$fg_bold[green]%}${PWD/#$HOME/~}%{$reset_color%}$(git_prompt_info) using %{$reset_color%}%{$fg[red]%}$(rbenv version | sed -e "s/ (set.*$//")%{$reset_color%} -$(virtualenv_info)$(prompt_char) ' - fi -fi +PROMPT='%F{magenta}%n%f at %F{yellow}%m%f in %B%F{green}%~%f%b$(git_prompt_info)$(ruby_prompt) +$(virtualenv_info) $(prompt_char) ' +ZSH_THEME_GIT_PROMPT_PREFIX=' on %F{magenta}' +ZSH_THEME_GIT_PROMPT_SUFFIX='%f' +ZSH_THEME_GIT_PROMPT_DIRTY='%F{green}!' +ZSH_THEME_GIT_PROMPT_UNTRACKED='%F{green}?' +ZSH_THEME_GIT_PROMPT_CLEAN='' -ZSH_THEME_GIT_PROMPT_PREFIX=" on %{$fg[magenta]%}" -ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" -ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" -ZSH_THEME_GIT_PROMPT_CLEAN="" +ZSH_THEME_RUBY_PROMPT_PREFIX=' using %F{red}' +ZSH_THEME_RUBY_PROMPT_SUFFIX='%f' diff --git a/themes/trapd00r.zsh-theme b/themes/trapd00r.zsh-theme index ca1676fb5..3fa5d57ab 100644 --- a/themes/trapd00r.zsh-theme +++ b/themes/trapd00r.zsh-theme @@ -36,7 +36,7 @@ local c12=$(printf "\e[38;5;142m\e[1m") local c13=$(printf "\e[38;5;196m\e[1m") -# We dont want to use the extended colorset in the TTY / VC. +# We don't want to use the extended colorset in the TTY / VC. if [ "$TERM" = "linux" ]; then c1=$( printf "\e[34;1m") c2=$( printf "\e[35m") @@ -71,7 +71,7 @@ prompt_jnrowe_precmd () { PROMPT='%{$fg_bold[green]%}%p%{$reset_color%}${vcs_info_msg_0_}${dir_status} ${ret_status}%{$reset_color%} > ' -# modified, to be commited +# modified, to be committed elif [[ $(git diff --cached --name-status 2>/dev/null ) != "" ]]; then dir_status="%{$c1%}%n%{$c4%}@%{$c2%}%m%{$c0%}:%{$c3%}%l%{$c6%}->%{$(zsh_path)%} %{$c0%}(%{$c5%}%?%{$c0%})" PROMPT='${vcs_info_msg_0_}%{$30%} %{$bg_bold[red]%}%{$fg_bold[cyan]%}C%{$fg_bold[black]%}OMMIT%{$reset_color%} diff --git a/themes/xiong-chiamiov-plus.zsh-theme b/themes/xiong-chiamiov-plus.zsh-theme index 095dae290..5fb4fe6f4 100644 --- a/themes/xiong-chiamiov-plus.zsh-theme +++ b/themes/xiong-chiamiov-plus.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # on two lines for easier vgrepping # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B] <$(git_prompt_info)>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/xiong-chiamiov.zsh-theme b/themes/xiong-chiamiov.zsh-theme index 7c4c2e4f8..0ed335fb5 100644 --- a/themes/xiong-chiamiov.zsh-theme +++ b/themes/xiong-chiamiov.zsh-theme @@ -1,6 +1,6 @@ # user, host, full path, and time/date # on two lines for easier vgrepping # entry in a nice long thread on the Arch Linux forums: http://bbs.archlinux.org/viewtopic.php?pid=521888#p521888 -PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %I:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} +PROMPT=$'%{\e[0;34m%}%B┌─[%b%{\e[0m%}%{\e[1;32m%}%n%{\e[1;30m%}@%{\e[0m%}%{\e[0;36m%}%m%{\e[0;34m%}%B]%b%{\e[0m%} - %b%{\e[0;34m%}%B[%b%{\e[1;37m%}%~%{\e[0;34m%}%B]%b%{\e[0m%} - %{\e[0;34m%}%B[%b%{\e[0;33m%}'%D{"%a %b %d, %H:%M"}%b$'%{\e[0;34m%}%B]%b%{\e[0m%} %{\e[0;34m%}%B└─%B[%{\e[1;35m%}$%{\e[0;34m%}%B]>%{\e[0m%}%b ' PS2=$' \e[0;34m%}%B>%{\e[0m%}%b ' diff --git a/themes/ys.zsh-theme b/themes/ys.zsh-theme index fd8adc41e..89d5355dc 100644 --- a/themes/ys.zsh-theme +++ b/themes/ys.zsh-theme @@ -1,18 +1,9 @@ # Clean, simple, compatible and meaningful. # Tested on Linux, Unix and Windows under ANSI colors. -# It is recommended to use with a dark background and the font Inconsolata. +# It is recommended to use with a dark background. # Colors: black, red, green, yellow, *blue, magenta, cyan, and white. -# -# http://ysmood.org/wp/2013/03/my-ys-terminal-theme/ -# Mar 2013 ys - -# Machine name. -function box_name { - [ -f ~/.box-name ] && cat ~/.box-name || echo $HOST -} - -# Directory info. -local current_dir='${PWD/#$HOME/~}' +# +# Mar 2013 Yad Smood # VCS YS_VCS_PROMPT_PREFIX1=" %{$fg[white]%}on%{$reset_color%} " @@ -21,7 +12,7 @@ YS_VCS_PROMPT_SUFFIX="%{$reset_color%}" YS_VCS_PROMPT_DIRTY=" %{$fg[red]%}x" YS_VCS_PROMPT_CLEAN=" %{$fg[green]%}o" -# Git info. +# Git info local git_info='$(git_prompt_info)' ZSH_THEME_GIT_PROMPT_PREFIX="${YS_VCS_PROMPT_PREFIX1}git${YS_VCS_PROMPT_PREFIX2}" ZSH_THEME_GIT_PROMPT_SUFFIX="$YS_VCS_PROMPT_SUFFIX" @@ -44,29 +35,26 @@ ys_hg_prompt_info() { fi } -# Prompt format: \n # USER at MACHINE in DIRECTORY on git:BRANCH STATE [TIME] \n $ -PROMPT=" -%{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ -%{$fg[cyan]%}%n \ -%{$fg[white]%}at \ -%{$fg[green]%}$(box_name) \ -%{$fg[white]%}in \ -%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\ -${hg_info}\ -${git_info} \ -%{$fg[white]%}[%*] -%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" +local exit_code="%(?,,C:%{$fg[red]%}%?%{$reset_color%})" -if [[ "$USER" == "root" ]]; then +# Prompt format: +# +# PRIVILEGES USER @ MACHINE in DIRECTORY on git:BRANCH STATE [TIME] C:LAST_EXIT_CODE +# $ COMMAND +# +# For example: +# +# % ys @ ys-mbp in ~/.oh-my-zsh on git:master x [21:47:42] C:0 +# $ PROMPT=" %{$terminfo[bold]$fg[blue]%}#%{$reset_color%} \ -%{$bg[yellow]%}%{$fg[cyan]%}%n%{$reset_color%} \ -%{$fg[white]%}at \ -%{$fg[green]%}$(box_name) \ +%(#,%{$bg[yellow]%}%{$fg[black]%}%n%{$reset_color%},%{$fg[cyan]%}%n) \ +%{$fg[white]%}@ \ +%{$fg[green]%}%m \ %{$fg[white]%}in \ -%{$terminfo[bold]$fg[yellow]%}${current_dir}%{$reset_color%}\ +%{$terminfo[bold]$fg[yellow]%}%~%{$reset_color%}\ ${hg_info}\ -${git_info} \ -%{$fg[white]%}[%*] +${git_info}\ + \ +%{$fg[white]%}[%*] $exit_code %{$terminfo[bold]$fg[red]%}$ %{$reset_color%}" -fi |