From 11318374e8d284860874bd2cb0201bc4708ef9c2 Mon Sep 17 00:00:00 2001 From: tfheen Date: Sat, 19 Sep 2009 09:22:05 +0000 Subject: [PATCH] Add vcs information to prompt git-svn-id: file:///svn/tfheen/trunk/dotfiles@1396 8da78d58-1cd3-0310-bee5-d77bd1b3e8bf --- zshrc | 25 +++++++++++++++++++++++-- zshrc.d/60_vcsprompt | 16 ++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 zshrc.d/60_vcsprompt diff --git a/zshrc b/zshrc index 92392c4..bb8ab95 100644 --- a/zshrc +++ b/zshrc @@ -1,15 +1,36 @@ # -*- sh -*- # +is_root() { + test ${EUID:?} -eq 0 +} + +sourcedir() { + set -x + if [ ! -d "$1" ]; then + echo "no such directory: $1" + return 1 + fi + for f in "$1"/*(.N,@N); do + case "$f" in + *~|*.bak|*.old|*.sw?|*.zwc|*.disabled) continue;; + esac + echo " sourcing file $f" + source "$f" + done +} + +_DIR=$HOME/${(%):-%1N}.d +sourcedir $_DIR + alias mv='nocorrect mv' # no spelling correction on mv alias cp='nocorrect cp' # no spelling correction on cp alias mkdir='nocorrect mkdir' # no spelling correction on mkdir alias ssh='ssh-add -l > /dev/null 2>&1 || ssh-add ; \ssh' - bindkey -e # Emacs-style commandline editing -PROMPT=": %U%n@%m%u${CHROOT} %B%30<..<%~%b %(!.#.>) " +PROMPT=': %(!.%F{red}.)%U%n@%m%u%(!.%f.)'${CHROOT}' ${vcs_info_msg_0_}%B%30<..<%~%b %(!.#.>) ' case `uname -s` in "FreeBSD") diff --git a/zshrc.d/60_vcsprompt b/zshrc.d/60_vcsprompt new file mode 100644 index 0000000..275917a --- /dev/null +++ b/zshrc.d/60_vcsprompt @@ -0,0 +1,16 @@ +# +# 60_vcsprompt +# +# +# + +setopt PROMPT_SUBST +autoload -Uz vcs_info +zstyle ':vcs_info:*' actionformats \ + '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{3}|%F{1}%a%F{5}]%f ' +zstyle ':vcs_info:*' formats \ + '%F{5}(%f%s%F{5})%F{3}-%F{5}[%F{2}%b%F{5}]%f ' +zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' +zstyle ':vcs_info:*' enable git svn +typeset -ga precmd_functions +precmd_functions+=vcs_info -- 2.39.5