From 57bb7242e4a9eaf99e0ad6d2fe3d5ba80eb635df Mon Sep 17 00:00:00 2001 From: Michael Komitee Date: Tue, 28 Dec 2010 18:01:51 -0500 Subject: [PATCH] bunch of fixes --- themes/komitee.zsh-theme | 60 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 5 deletions(-) diff --git a/themes/komitee.zsh-theme b/themes/komitee.zsh-theme index 2bb0449ed..e810656d1 100644 --- a/themes/komitee.zsh-theme +++ b/themes/komitee.zsh-theme @@ -1,3 +1,48 @@ +if [ -f ~/.pathrc ]; then + path=() + typeset -U path + for dir in $(<$HOME/.pathrc); do + path+=($dir) + done +fi + +if [ -f ~/.manpathrc ]; then + typeset -U manpath + manpath=() + for dir in $(<$HOME/.manpathrc); do + manpath+=($dir) + done +fi + +function current_dir() { + local -a regex + local current_dir=$(pwd) + local full_dir=${current_dir/${HOME}/\~} + if [[ ${#full_dir} > 15 ]]; then + if [[ ${full_dir} =~ "^(~/|/)([^/]+)/.+/([^/]+)$" ]]; then + local short_dir="$match[1]$match[2]/.../$match[3]" + if [[ ${#full_dir} > ${#short_dir} ]]; then + echo $short_dir + else + echo $full_dir + fi + else + echo $full_dir + fi + else + echo $full_dir + fi +} + +function svn_repository() { + if [ -d .svn ]; then + local -a regex + svn_info=$(svn info) + if [[ ${svn_info} =~ "Repository Root: \S+/(\S+)" ]]; then + echo "%{$fg[blue]%}(svn:$match)%{$reset_color%}" + fi + fi +} # setup basic prompt local user="$(whoami)" @@ -43,19 +88,24 @@ fi local exit_code="%(?,,%{$fg[red]%}[%?]%{$reset_color%})" # Put it all together -PROMPT='${exit_code}%{$fg[cyan]%}[${user_host} %{$fg[yellow]%}%~%{$fg[cyan]%}]$(jobs_prompt_info)${shell_level}${prompt_char} ' +PROMPT='${exit_code}%{$fg[cyan]%}[${user_host} %{$fg[yellow]%}$(current_dir)%{$fg[cyan]%}]$(jobs_prompt_info)${shell_level}${prompt_char} ' # Setup vi mode indicator MODE_INDICATOR="%{$fg_bold[yellow]%}%{$reset_color%}" # Setup git prompt info -ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}(" +ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[blue]%}(git:" ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} " -ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[red]%}⚡%{$reset_color%}" +ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%})%{$fg[red]%}!%{$reset_color%}" ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%})" # setup right prompt -RPROMPT='$(git_prompt_info)$(vi_mode_prompt_info)' +RPROMPT='$(svn_repository)$(git_prompt_info)$(vi_mode_prompt_info)' -# vim: set ft=zsh +if [ "$DISABLE_LS_COLORS" != "true" ] +then + # Find the option for using colors in ls, depending on the version: Linux or BSD + ls --color -d . &>/dev/null 2>&1 && alias ls='ls --color=tty -F -h' || alias ls='ls -GFh' +fi +# vim: set ft=zsh ts=4 sw=4 et: