reduced the code of the plugin

This commit is contained in:
Benjamin Martinez 2011-04-12 17:45:58 -07:00
commit 91f18f7750

View file

@ -1,7 +1,4 @@
## Gets branch name
hg_branch_name(){
hg branch 2> /dev/null | awk '{ print $1 }' || return
}
## Gets branch name and dirty clean status of repo
parse_hg_dirty() {
if [[ -n $(hg status 2> /dev/null) ]]; then
echo "$ZSH_THEME_HG_PROMPT_DIRTY"
@ -12,20 +9,18 @@ parse_hg_dirty() {
hg_prompt_info(){
if [[ -d .hg ]]; then
echo "$ZSH_THEME_HG_PROMPT_PREFIX$(hg_branch_name)$(parse_hg_dirty )$ZSH_THEME_HG_PROMPT_SUFFIX"
echo "$ZSH_THEME_HG_PROMPT_PREFIX$(hg branch | awk '{ print $1 }')$(parse_hg_dirty )$ZSH_THEME_HG_PROMPT_SUFFIX"
fi
}
## Gets bookmark name
hg_bookmark_name() {
hg bookmarks 2> /dev/null | awk '{ print $2 }' || return
}
hg_prompt_bookmarks() {
if [[ -d .hg ]]; then
echo "$ZSH_THEME_HG_PROMPT_BOOKMARK_PREFIX$(hg_bookmark_name)$ZSH_THEME_HG_BOOKMARK_PROMPT_SUFFIX"
echo "$ZSH_THEME_HG_PROMPT_BOOKMARK_PREFIX$(hg bookmarks | awk '{ print $2 }')$ZSH_THEME_HG_BOOKMARK_PROMPT_SUFFIX"
fi
}
## Gets repo status (hg status is a slow command this will problably make the prompt I little slow )
hg_prompt_status() {
STATUS=""
@ -55,3 +50,4 @@ hg_prompt_status() {
echo $STATUS
}