Prompt fixes in zsh.

This commit is contained in:
2014-04-08 11:00:25 -07:00
parent cfc5cdbb6f
commit d8d47433d0
8 changed files with 51 additions and 47 deletions

View File

@@ -35,6 +35,8 @@ command -v md5sum > /dev/null || alias md5sum="md5"
# OS X has no `sha1sum`, so use `shasum` as a fallback
command -v sha1sum > /dev/null || alias sha1sum="shasum"
command -v greadlink > /dev/null && alias readlink="greadlink"
# URL-encode strings
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"'

View File

@@ -4,8 +4,12 @@ function parse_git_branch() {
echo ${ref#refs/heads/}
}
function git_is_dirty() {
git diff-index --quiet --cached HEAD && git diff-files --quiet
}
function current_shell() {
ps -p $$ | tail -1 | awk '{print $NF}' | xargs which | xargs readlink -f
greadlink -f $(which "$(ps -p $$ | tail -1 | awk '{print $NF}' | sed 's/\-//')")
}
function is_zsh() {

View File

@@ -51,7 +51,8 @@ function sandbox_prompt_info() {
if [ "$YELP_IN_SANDBOX" ];
then
sandbox_string=$sandbox_string"sandbox-$(get_sandbox_identifier)"
else
elif [ ! -z $(env | grep YELP) ];
then
sandbox_string="no sandbox"
fi
echo $sandbox_string
@@ -77,11 +78,11 @@ function zsh_sandbox_color() {
}
function colored_sandbox_string() {
if [ is_zsh ]
if [ is_zsh ];
then
sandbox_color=$(zsh_sandbox_color)
else
sandbox_color=$(bash_sandbox_color)
fi
echo $sandbox_color$(sandbox_prompt_info)
echo "$sandbox_color$(sandbox_prompt_info)%{$reset_color%}"
}