diff options
author | Matt Singleton <matthew.j.singleton@gmail.com> | 2011-01-13 17:58:41 -0500 |
---|---|---|
committer | Matt Singleton <matthew.j.singleton@gmail.com> | 2011-01-13 17:58:41 -0500 |
commit | 0452f449864ce97fa57b4e46796409d6534e8243 (patch) | |
tree | 330607dcc7ee51213106680a86abd2376237517c | |
parent | 3f84b01bf8d91765037a33b6aa83246c6060dc66 (diff) |
speeding up prompt by using faster vcs commands; adding exit code and updated time info to prompt
-rw-r--r-- | oh-my-zsh/xcolour.zsh-theme | 48 | ||||
-rw-r--r-- | zshrc | 4 |
2 files changed, 50 insertions, 2 deletions
diff --git a/oh-my-zsh/xcolour.zsh-theme b/oh-my-zsh/xcolour.zsh-theme index 3ab82ff..1578a47 100644 --- a/oh-my-zsh/xcolour.zsh-theme +++ b/oh-my-zsh/xcolour.zsh-theme @@ -6,9 +6,53 @@ function prompt_char { echo '$' } +function return_code { + code=$(echo $?) + if [[ $code == "0" ]]; then + return + else + echo "%{$fg[red]%}$code%{$reset_color%} " + fi +} + +function parse_git_branch { + echo "${ref#refs/heads/}" +} + +function parse_git_staged { + $(git diff-index --quiet --cached HEAD) && return + echo "staged" +} +function parse_git_unstaged { + $(git diff-files --quiet) && return + echo "unstaged" +} + +function my_git_prompt_info { + ref=$(git symbolic-ref HEAD 2> /dev/null) || return +# # staged +# git diff-index --quiet --cached HEAD +# if [ $? -eq 1 ]; then +# echo "(%{$fg[yellow]%}${ref#refs/heads/}%{$reset_color%}) " +# return +# fi +# # uunstaged +# git ls-files --exclude-standard --others +# if [ $? -eq 1 ]; then +# echo "(%{$fg[red]%}${ref#refs/heads/}%{$reset_color%}) " +# return +# fi +# # untracked and unignored +# git diff-files --quiet +# if [ $? -eq 1 ]; then +# echo "(%{$fg[red]%}${ref#refs/heads/}%{$reset_color%}) " +# return +# fi + echo "(${ref#refs/heads/}) " +} + PROMPT='%{$fg[yellow]%}%n%{$reset_color%}@%{$fg[green]%}%m%{$reset_color%}:%{$fg[blue]%}%~%{$reset_color%} -$(prompt_char) %{$reset_color%}' -RPROMPT='%D{%r}' +$(return_code)$(my_git_prompt_info)$(prompt_char) %{$reset_color%}' ZSH_THEME_GIT_PROMPT_PREFIX="(" ZSH_THEME_GIT_PROMPT_SUFFIX=") " @@ -41,3 +41,7 @@ fi # run after local because local because user bin should # take absolute priority export PATH=$HOME/bin:$PATH + +function preexec () { + echo "($fg[magenta]`date +%r`$reset_color) $fg[cyan]$3$reset_color" +} |