From dc97362297428184ca1f7d856433d5208160d026 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Fri, 25 Apr 2014 13:23:07 -0700 Subject: [PATCH] Update prompt character based on whether in git repository. --- dotfiles/lib/zsh/prompt.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/dotfiles/lib/zsh/prompt.sh b/dotfiles/lib/zsh/prompt.sh index bf04d6ec..e76608ac 100644 --- a/dotfiles/lib/zsh/prompt.sh +++ b/dotfiles/lib/zsh/prompt.sh @@ -56,6 +56,15 @@ function sandbox_prompt() { fi } +function command_line_character() { + if ! test -z $(git branch-or-sha); + then + echo "±" + else + echo "○" + fi +} + function prompt_custom_colors() { export USERNAME_COLOR="$FG[040]" export SEPARATOR_COLOR="$FG[239]" @@ -87,7 +96,7 @@ function separator() { prompt_basic_colors_with_grey_separator PROMPT='╭─% $(print_with_color "%n" "$USERNAME_COLOR") $(separator "at") $(print_with_color "`hostname -s`" "$HOSTNAME_COLOR") $(separator "in") $(print_with_color "`current_directory`" "$terminfo[bold]$CURRENT_DIRECTORY_COLOR")$(git_prompt_info)$(sandbox_prompt) -╰─± ' +╰─$(command_line_character) ' PS2='(%_) '