From 057627d1d19a2fc33fbf81fea8b561b88a2413fd Mon Sep 17 00:00:00 2001 From: tim Date: Fri, 19 Aug 2011 21:38:16 -0500 Subject: [PATCH 1/3] Tiny theme! --- themes/tiny.zsh-theme | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 themes/tiny.zsh-theme diff --git a/themes/tiny.zsh-theme b/themes/tiny.zsh-theme new file mode 100644 index 000000000..f82ee02a6 --- /dev/null +++ b/themes/tiny.zsh-theme @@ -0,0 +1,39 @@ +# This is a theme that tends to be smaller than minimal, but it still has some neat features: +# * if the working directory is a git repository, you'll see a '±' +# * git status is shown by the color of the '±' +# * you'll only ever see the branch name it isn't master + +function collapse_pwd { + echo `pwd | sed -e "s,^$HOME,~,"` +} + +function prompt_character { + # if you're in a git branch, the prompt character is '±' + # (this is handled by git_colors) + git branch >> /dev/null 2>> /dev/null && echo "%{$fg[`git_colors`]%}±%{$reset_color%}" && return + # else, it's a blank space + echo " " +} + +function git_colors { + # if everything has been committed, return 'green' + git status | grep "nothing to commit (working directory clean)" >> /dev/null && echo 'green' \ + && return + # if it's dirty, return 'rd' + git status | grep "# Changes not staged for commit:" >> /dev/null && echo 'red' && return + git status | grep "# Untracked files:" >> /dev/null && echo 'red' && return + # if everything is staged, return 'magenta' + echo 'magenta' +} + +function git_branch { + # only actually echo anything if this is a git repo and the branch isn't master + local cb=$(current_branch) + if [ -n "$cb" ]; then + if [ "$cb" != "master" ]; then + echo "[`current_branch`] " + fi + fi +} + +PROMPT='$(collapse_pwd) %{$fg[cyan]%}$(git_branch)%{$reset_color%}$(prompt_character) » ' From bb59f4ece05fc4487c568df0ec9411ad8240725f Mon Sep 17 00:00:00 2001 From: startling things Date: Fri, 9 Sep 2011 14:02:31 -0500 Subject: [PATCH 2/3] got rid of the annoying space in the tiny theme --- themes/tiny.zsh-theme | 2 -- 1 file changed, 2 deletions(-) diff --git a/themes/tiny.zsh-theme b/themes/tiny.zsh-theme index f82ee02a6..00d413781 100644 --- a/themes/tiny.zsh-theme +++ b/themes/tiny.zsh-theme @@ -11,8 +11,6 @@ function prompt_character { # if you're in a git branch, the prompt character is '±' # (this is handled by git_colors) git branch >> /dev/null 2>> /dev/null && echo "%{$fg[`git_colors`]%}±%{$reset_color%}" && return - # else, it's a blank space - echo " " } function git_colors { From 76aa2ecfe82a3ef94c2f9442116fb9ca057a66e7 Mon Sep 17 00:00:00 2001 From: startling things Date: Fri, 9 Sep 2011 14:12:03 -0500 Subject: [PATCH 3/3] pwd prompt in tiny theme is actually cyan now also fixed some issues with spacing that came up. --- themes/tiny.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/tiny.zsh-theme b/themes/tiny.zsh-theme index 00d413781..9aee83d8e 100644 --- a/themes/tiny.zsh-theme +++ b/themes/tiny.zsh-theme @@ -10,7 +10,7 @@ function collapse_pwd { function prompt_character { # if you're in a git branch, the prompt character is '±' # (this is handled by git_colors) - git branch >> /dev/null 2>> /dev/null && echo "%{$fg[`git_colors`]%}±%{$reset_color%}" && return + git branch >> /dev/null 2>> /dev/null && echo "%{$fg[`git_colors`]%} ±%{$reset_color%}" && return } function git_colors { @@ -34,4 +34,4 @@ function git_branch { fi } -PROMPT='$(collapse_pwd) %{$fg[cyan]%}$(git_branch)%{$reset_color%}$(prompt_character) » ' +PROMPT='%{$fg[cyan]%}$(collapse_pwd)$(git_branch)%{$reset_color%}$(prompt_character) » '