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

@@ -3,16 +3,33 @@ function current_directory() {
echo "${PWD/#$HOME/~}"
}
function git_prompt_info () {
function git_prompt_info() {
if test -z $(parse_git_branch);
then
echo ""
else
echo " %{$FG[239]%}on%{$reset_color%} %{$FG[255]%}$(parse_git_branch)%{$reset_color%}"
echo " %{$FG[239]%}on%{$reset_color%} %{$FG[255]%}$(parse_git_branch)%{$reset_color%}$(git_status_character)"
fi
}
PROMPT='%{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(hostname -s)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}$(current_directory)%{$reset_color%}$(git_prompt_info) %{$FG[239]%}with $(colored_sandbox_string)%{$FG[255]%}%{$reset_color%} '
function git_status_character() {
if git_is_dirty;
then
echo "%{$FG[202]%}✘%{$reset_color%}"
else
echo "%{$FG[040]%}✔%{$reset_color%}"
fi
}
function sandbox_prompt() {
if [ ! -z $(sandbox_prompt_info) ];
then
echo " %{$FG[239]%}with $(colored_sandbox_string)%{$reset_color%}"
fi
}
PROMPT='╭─% %{$FG[040]%}%n%{$reset_color%} %{$FG[239]%}at%{$reset_color%} %{$FG[033]%}$(hostname -s)%{$reset_color%} %{$FG[239]%}in%{$reset_color%} %{$terminfo[bold]$FG[226]%}$(current_directory)%{$reset_color%}$(git_prompt_info)$(sandbox_prompt)
$FG[255]╰─± '
PS2=''