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