mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
correct agnoster theme and add myself zshrc
This commit is contained in:
parent
d6d34f7def
commit
4500f34643
2 changed files with 5 additions and 61 deletions
|
|
@ -26,7 +26,7 @@
|
||||||
# A few utility functions to make it easy and re-usable to draw segmented prompts
|
# A few utility functions to make it easy and re-usable to draw segmented prompts
|
||||||
|
|
||||||
CURRENT_BG='NONE'
|
CURRENT_BG='NONE'
|
||||||
SEGMENT_SEPARATOR=''
|
SEGMENT_SEPARATOR='⮀'
|
||||||
|
|
||||||
# Begin a segment
|
# Begin a segment
|
||||||
# Takes two arguments, background and foreground. Both can be omitted,
|
# Takes two arguments, background and foreground. Both can be omitted,
|
||||||
|
|
@ -71,6 +71,7 @@ prompt_context() {
|
||||||
prompt_git() {
|
prompt_git() {
|
||||||
local ref dirty
|
local ref dirty
|
||||||
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
if $(git rev-parse --is-inside-work-tree >/dev/null 2>&1); then
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY='±'
|
||||||
dirty=$(parse_git_dirty)
|
dirty=$(parse_git_dirty)
|
||||||
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
|
ref=$(git symbolic-ref HEAD 2> /dev/null) || ref="➦ $(git show-ref --head -s --abbrev |head -n1 2> /dev/null)"
|
||||||
if [[ -n $dirty ]]; then
|
if [[ -n $dirty ]]; then
|
||||||
|
|
@ -78,70 +79,15 @@ prompt_git() {
|
||||||
else
|
else
|
||||||
prompt_segment green black
|
prompt_segment green black
|
||||||
fi
|
fi
|
||||||
|
echo -n "${ref/refs\/heads\//⭠ }$dirty"
|
||||||
setopt promptsubst
|
|
||||||
autoload -Uz vcs_info
|
|
||||||
|
|
||||||
zstyle ':vcs_info:*' enable git
|
|
||||||
zstyle ':vcs_info:*' get-revision true
|
|
||||||
zstyle ':vcs_info:*' check-for-changes true
|
|
||||||
zstyle ':vcs_info:*' stagedstr '✚'
|
|
||||||
zstyle ':vcs_info:git:*' unstagedstr '●'
|
|
||||||
zstyle ':vcs_info:*' formats ' %u%c'
|
|
||||||
zstyle ':vcs_info:*' actionformats '%u%c'
|
|
||||||
vcs_info
|
|
||||||
echo -n "${ref/refs\/heads\// }${vcs_info_msg_0_}"
|
|
||||||
fi
|
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
|
# Dir: current working directory
|
||||||
prompt_dir() {
|
prompt_dir() {
|
||||||
prompt_segment blue black '%~'
|
prompt_segment blue black '%~'
|
||||||
}
|
}
|
||||||
|
|
||||||
# Virtualenv: current working virtualenv
|
|
||||||
prompt_virtualenv() {
|
|
||||||
local virtualenv_path="$VIRTUAL_ENV"
|
|
||||||
if [[ -n $virtualenv_path ]]; then
|
|
||||||
prompt_segment blue black "(`basename $virtualenv_path`)"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Status:
|
# Status:
|
||||||
# - was there an error
|
# - was there an error
|
||||||
# - am I root
|
# - am I root
|
||||||
|
|
@ -160,12 +106,10 @@ prompt_status() {
|
||||||
build_prompt() {
|
build_prompt() {
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
prompt_status
|
prompt_status
|
||||||
prompt_virtualenv
|
|
||||||
prompt_context
|
prompt_context
|
||||||
prompt_dir
|
prompt_dir
|
||||||
prompt_git
|
prompt_git
|
||||||
prompt_hg
|
|
||||||
prompt_end
|
prompt_end
|
||||||
}
|
}
|
||||||
|
|
||||||
PROMPT='%{%f%b%k%}$(build_prompt) '
|
PROMPT='%{%f%b%k%}$(build_prompt) '
|
||||||
2
zshrc
2
zshrc
|
|
@ -35,6 +35,6 @@ plugins=(git)
|
||||||
source $ZSH/oh-my-zsh.sh
|
source $ZSH/oh-my-zsh.sh
|
||||||
|
|
||||||
# Customize to your needs...
|
# Customize to your needs...
|
||||||
export PATH=/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/harry/bin:/home/harry/HarrysFile/Develop/jdk1.7.0_06/bin:/home/harry/bin:/home/harry/HarrysFile/Develop/jre1.7.0_05/bin
|
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/harry/bin:/home/harry/Project/android-sdk-linux/platform-tools:/home/harry/Project/android-sdk-linux/tools
|
||||||
|
|
||||||
#export HTTP_PROXY=http://192.168.2.22:8087
|
#export HTTP_PROXY=http://192.168.2.22:8087
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue