diff options
author | Florian Pritz <f-p@gmx.at> | 2009-02-24 21:11:55 +0100 |
---|---|---|
committer | Florian Pritz <f-p@gmx.at> | 2009-02-24 21:11:55 +0100 |
commit | 0248538340fa980a7a48afd780789c9159055c66 (patch) | |
tree | 7da7be7628d799d3dd8465858e1d082232f02c2e /.zsh | |
parent | c11962cc67d1b78692bf6e767a436f06c1ef4880 (diff) | |
download | dotfiles-0248538340fa980a7a48afd780789c9159055c66.tar.gz dotfiles-0248538340fa980a7a48afd780789c9159055c66.tar.xz |
added current git branch to prompt
Diffstat (limited to '.zsh')
-rw-r--r-- | .zsh/rc/15prompt | 10 | ||||
-rw-r--r-- | .zsh/rc/50options | 1 |
2 files changed, 10 insertions, 1 deletions
diff --git a/.zsh/rc/15prompt b/.zsh/rc/15prompt index c972c8a..5eb75ec 100644 --- a/.zsh/rc/15prompt +++ b/.zsh/rc/15prompt @@ -19,6 +19,9 @@ prompt_eof_setup() { prompt_eof_setup "$@" + + + # function to show the current git branch in prompt parse_git_branch() { git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' @@ -27,10 +30,15 @@ parse_git_branch() { #-------------------- # Prompt #-------------------- -#PS1="[${fg_cyan}%*${fg_no_colour}] - ${fg_light_red}$USERNAME${fg_no_colour} ${fg_light_blue}%~${fg_no_colour} > " +# necessary if you want to use functions in the prompt +# without this they wouldn't be run again +precmd () { +# this has to be on the edge or you have some spaces in the prompt +# if you have any workaround please tell PS1="${fg_light_red}$USERNAME${fg_no_colour}@${fg_light_green}%m${fg_no_colour} \ - ${fg_light_blue}%~${fg_no_colour} ${fg_purple}$(parse_git_branch)${fg_no_colour} [${fg_cyan}%*${fg_no_colour}] > " +} ## Spelling prompt SPROMPT='zsh: correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) ' diff --git a/.zsh/rc/50options b/.zsh/rc/50options index fda3936..0b6d237 100644 --- a/.zsh/rc/50options +++ b/.zsh/rc/50options @@ -43,3 +43,4 @@ setopt EXTENDED_HISTORY setopt HIST_REDUCE_BLANKS setopt HIST_IGNORE_SPACE setopt nohistverify +setopt prompt_subst |