mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
reduced the code of the plugin
This commit is contained in:
parent
98de353320
commit
91f18f7750
1 changed files with 9 additions and 13 deletions
|
|
@ -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,24 +9,22 @@ 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=""
|
||||
|
||||
if $( hg status -A| grep "^M" > /dev/null); then
|
||||
if $( hg status -A | grep "^M" > /dev/null); then
|
||||
STATUS="$ZSH_THEME_HG_PROMPT_MODIFIED$STATUS"
|
||||
fi
|
||||
|
||||
|
|
@ -53,5 +48,6 @@ hg_prompt_status() {
|
|||
STATUS="$ZSH_THEME_HG_PROMPT_UNMERGED$STATUS"
|
||||
fi
|
||||
|
||||
echo $STATUS
|
||||
echo $STATUS
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue