mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
New theme std:
- [std-theme]: added new theme - [git-lib]: extended git library - [vagrant-lib]: added new lib for vagrant
This commit is contained in:
parent
79196f8213
commit
af0659f3c3
3 changed files with 52 additions and 0 deletions
16
lib/git.zsh
16
lib/git.zsh
|
|
@ -133,6 +133,22 @@ function git_compare_version() {
|
||||||
echo 1
|
echo 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function git_prompt_no_changed_files {
|
||||||
|
|
||||||
|
if [ ! -d .git ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
local NO_OF_CHANGED_FILES
|
||||||
|
|
||||||
|
NO_OF_CHANGED_FILES=$(git status -s 2> /dev/null | wc -l | sed 's/ *//g')
|
||||||
|
if [ $NO_OF_CHANGED_FILES != 0 ]; then
|
||||||
|
echo " $NO_OF_CHANGED_FILES"
|
||||||
|
else
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#this is unlikely to change so make it all statically assigned
|
#this is unlikely to change so make it all statically assigned
|
||||||
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
|
POST_1_7_2_GIT=$(git_compare_version "1.7.2")
|
||||||
#clean up the namespace slightly by removing the checker function
|
#clean up the namespace slightly by removing the checker function
|
||||||
|
|
|
||||||
15
lib/vagrant.zsh
Normal file
15
lib/vagrant.zsh
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
function vagrant_prompt_status {
|
||||||
|
if [ ! -f Vagrantfile ]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
VAGRANT_BOX=$(grep 'config.vm.box =' Vagrantfile | awk '{print $3}')
|
||||||
|
VARGANT_STATE=$(vagrant status 2>/dev/null | grep default | awk {'print $2'})
|
||||||
|
case "$VARGANT_STATE" in
|
||||||
|
"running") VARGANT_STATUS=$ZSH_THEME_VAGRANT_PROMPT_ON;;
|
||||||
|
stopped|poweroff|saved) VARGANT_STATUS=$ZSH_THEME_VAGRANT_PROMPT_OFF;;
|
||||||
|
*) return
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "default($VAGRANT_BOX): $VARGANT_STATE $VARGANT_STATUS"
|
||||||
|
}
|
||||||
21
themes/std.zsh-theme
Normal file
21
themes/std.zsh-theme
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
# FILE: std.zsh-theme
|
||||||
|
# DESCRIPTION: oh-my-zsh theme file
|
||||||
|
# AUTHOR: Andrii Grytsenko <andrii.grytsenko@gmail.com>
|
||||||
|
# VERSION: 0.1
|
||||||
|
# SCREENSHOT: http://s23.postimg.org/dlcljx5kb/std.png
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
NOT_OK="%{$fg[red]%} ☻ %{$reset_color%}"
|
||||||
|
OK="%{$fg[green]%} ☻ %{$reset_color%}"
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX=""
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY=$NOT_OK
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=$OK
|
||||||
|
|
||||||
|
ZSH_THEME_VAGRANT_PROMPT_OFF=$NOT_OK
|
||||||
|
ZSH_THEME_VAGRANT_PROMPT_ON=$OK
|
||||||
|
|
||||||
|
PROMPT='%{$fg[red]%}%n@%m%{$reset_color%}%{$fg_bold[red]%} %{$reset_color%}%{$fg[white]%}%0~%{$reset_color%}%{$fg_bold[blue]%} => %{$reset_color%} '
|
||||||
|
RPROMPT='%{$reset_color%}%{$fg_bold[blue]%}$(git_prompt_short_sha)$(git_prompt_no_changed_files) $(git_prompt_info) $(vagrant_prompt_status)%{$reset_color%}'
|
||||||
Loading…
Add table
Add a link
Reference in a new issue