From 02ec35a8d44a5dab97816c5d9ee74f56a5ef379f Mon Sep 17 00:00:00 2001 From: Matt Hamilton Date: Fri, 18 Dec 2015 11:02:56 -0500 Subject: [PATCH] add gitster theme --- modules/prompt/functions/prompt_gitster_setup | 1 + modules/prompt/themes/gitster.zsh-theme | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 120000 modules/prompt/functions/prompt_gitster_setup create mode 100644 modules/prompt/themes/gitster.zsh-theme diff --git a/modules/prompt/functions/prompt_gitster_setup b/modules/prompt/functions/prompt_gitster_setup new file mode 120000 index 0000000..a818a68 --- /dev/null +++ b/modules/prompt/functions/prompt_gitster_setup @@ -0,0 +1 @@ +../themes/gitster.zsh-theme \ No newline at end of file diff --git a/modules/prompt/themes/gitster.zsh-theme b/modules/prompt/themes/gitster.zsh-theme new file mode 100644 index 0000000..2de829e --- /dev/null +++ b/modules/prompt/themes/gitster.zsh-theme @@ -0,0 +1,28 @@ +# +# Gitster theme +# https://github.com/shashankmehta/dotfiles/blob/master/thesetup/zsh/.oh-my-zsh/custom/themes/gitster.zsh-theme +# + +local ret_status="%(?:%{$fg_bold[green]%}➜ :%{$fg_bold[red]%}➜ %s)" + +function get_pwd(){ + git_root=$PWD + while [[ $git_root != / && ! -e $git_root/.git ]]; do + git_root=$git_root:h + done + if [[ $git_root = / ]]; then + unset git_root + prompt_short_dir=%~ + else + parent=${git_root%\/*} + prompt_short_dir=${PWD#$parent/} + fi + print $prompt_short_dir +} + +PROMPT='$ret_status %{$fg[white]%}$(get_pwd) $(git_prompt_info)%{$reset_color%}%{$reset_color%} ' + +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[cyan]%}" +ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[yellow]%}✗%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_CLEAN=" %{$fg[green]%}✓%{$reset_color%}"