Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
4e101bed
Commit
4e101bed
authored
Mar 26, 2013
by
Robby Russell
Browse files
Merge pull request #1558 from sbooob/master
Mercurial repository info in agnoster theme
parents
22390353
5128669a
Changes
1
Hide whitespace changes
Inline
Side-by-side
themes/agnoster.zsh-theme
View file @
4e101bed
...
...
@@ -83,6 +83,41 @@ prompt_git() {
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
prompt_dir
()
{
prompt_segment blue black
'%~'
...
...
@@ -109,6 +144,7 @@ build_prompt() {
prompt_context
prompt_dir
prompt_git
prompt_hg
prompt_end
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment