mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-06 02:51:32 +01:00
Merge branch 'master' of https://github.com/robbyrussell/oh-my-zsh
This commit is contained in:
commit
7c14896fb1
23 changed files with 677 additions and 43 deletions
|
|
@ -83,6 +83,41 @@ prompt_git() {
|
|||
fi
|
||||
}
|
||||
|
||||
prompt_hg() {
|
||||
local rev status
|
||||
if $(hg id >/dev/null 2>&1); then
|
||||
if $(hg prompt >/dev/null 2>&1); then
|
||||
if [[ $(hg prompt "{status|unknown}") = "?" ]]; then
|
||||
# if files are not added
|
||||
prompt_segment red white
|
||||
st='±'
|
||||
elif [[ -n $(hg prompt "{status|modified}") ]]; then
|
||||
# if any modification
|
||||
prompt_segment yellow black
|
||||
st='±'
|
||||
else
|
||||
# if working copy is clean
|
||||
prompt_segment green black
|
||||
fi
|
||||
echo -n $(hg prompt "⭠ {rev}@{branch}") $st
|
||||
else
|
||||
st=""
|
||||
rev=$(hg id -n 2>/dev/null | sed 's/[^-0-9]//g')
|
||||
branch=$(hg id -b 2>/dev/null)
|
||||
if `hg st | grep -Eq "^\?"`; then
|
||||
prompt_segment red black
|
||||
st='±'
|
||||
elif `hg st | grep -Eq "^(M|A)"`; then
|
||||
prompt_segment yellow black
|
||||
st='±'
|
||||
else
|
||||
prompt_segment green black
|
||||
fi
|
||||
echo -n "⭠ $rev@$branch" $st
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Dir: current working directory
|
||||
prompt_dir() {
|
||||
prompt_segment blue black '%~'
|
||||
|
|
@ -109,6 +144,7 @@ build_prompt() {
|
|||
prompt_context
|
||||
prompt_dir
|
||||
prompt_git
|
||||
prompt_hg
|
||||
prompt_end
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ fi
|
|||
DALLAS_CURRENT_MACH_="%{$fg[green]%}%m%{$fg[white]%}:%{$reset_color%}"
|
||||
# Grab the current filepath, use shortcuts: ~/Desktop
|
||||
# Append the current git branch, if in a git repository: ~aw@master
|
||||
DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}"
|
||||
DALLAS_CURRENT_LOCA_="%{$fg[cyan]%}%~\$(git_prompt_info)%{$reset_color%}\$(parse_git_dirty)"
|
||||
# Grab the current username: dallas
|
||||
DALLAS_CURRENT_USER_="%{$fg[red]%}%n%{$reset_color%}"
|
||||
# Use a % for normal users and a # for privelaged (root) users.
|
||||
|
|
|
|||
34
themes/ys.zsh-theme
Normal file
34
themes/ys.zsh-theme
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# 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.
|
||||
# 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 || hostname -s
|
||||
}
|
||||
|
||||
# Directory info.
|
||||
local current_dir='${PWD/#$HOME/~}'
|
||||
|
||||
# Git info.
|
||||
local git_info='$(git_prompt_info)'
|
||||
ZSH_THEME_GIT_PROMPT_PREFIX=" %{$fg[white]%}on%{$reset_color%} git:%{$fg[cyan]%}"
|
||||
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
|
||||
ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}x"
|
||||
ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}o"
|
||||
|
||||
# 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%}\
|
||||
${git_info} \
|
||||
%{$fg[white]%}[%*]
|
||||
%{$terminfo[bold]$fg[red]%}$ %{$reset_color%}"
|
||||
Loading…
Add table
Add a link
Reference in a new issue