Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

still playing with the prompt

  • Loading branch information...
commit 3e0ccfbd80553511fe1e424bf254f9d2948843a8 1 parent e42c235
@mattfoster mattfoster authored
Showing with 37 additions and 30 deletions.
  1. +8 −1 01_path
  2. +1 −1  10_hooks
  3. +7 −0 README.md
  4. +12 −28 func/prompt_git_setup
  5. +9 −0 rc
View
9 01_path
@@ -1,5 +1,6 @@
# Add some dirs to the path.
pathdirs=(/Library/Frameworks/Python.framework/Versions/Current/bin
+ /usr/local/bin
/usr/local/git/bin
/usr/local/libexec/git-core
/var/lib/gems/1.8/bin
@@ -19,7 +20,13 @@ for dir ($dirs)
fi
# Add function paths
-funcdirs=( $HOME/.zsh/func /sw/share/zsh/ /sw/share/zsh/VCS_Info /sw/share/zsh/VCS_Info/Backends)
+# funcdirs=( $HOME/.zsh/func /sw/share/zsh/ /sw/share/zsh/VCS_Info /sw/share/zsh/VCS_Info/Backends)
+# I'm using a manually installed zsh 4.3.9
+
+binary=$(which zsh)
+install_path=$binary:h:h # Strip bin/zsh to find installation path.
+
+funcdirs=( $HOME/.zsh/func $install_path/share/zsh/4.3.9/functions)
for dir ($funcdirs)
if [[ -x $dir ]]; then
fpath=($fpath $dir)
View
2  10_hooks
@@ -26,7 +26,7 @@ function precmd() {
if [[ $git_enable == 1 ]]; then
vcs_info
else
- vcs_info_msg_0_=''
+ vcs_info_msg_0_=''
fi
# This loads the info messgage into %1v.
title "zsh" "$USER@%m" "%55<...<%~"
View
7 README.md
@@ -6,3 +6,10 @@ An easily extensible collection of `stuff` for zsh.
## Prompt info
I'm currently playing with the prompt, using `vcs_info`. For this to work, you'll need a version zsh > 4.3.6 (IIRC).
+
+## Current issues:
+
+* I haven't found a way to easily show when the repo is dirty.
+* On my mac, opening additional zsh terminals doesn't give me coloured prompts.
+* I keep seeing bits and bobs alluding to a 'new prompt colour' syntax, but I can't find any docs.
+
View
40 func/prompt_git_setup
@@ -11,37 +11,21 @@
# Prompt setup function
function prompt_git_setup {
- unset PS1 PS2 PS3 PS4 PROMPT RPROMPT
- autoload -Uz vcs_info
- zstyle ':vcs_info:*' formats '%{'${fg[yellow]}'%}%b '
- zstyle ':vcs_info:(svn|bzr):*' branchformat '%b%{'${fg[yellow]}'%}:%r'
- zstyle ':vcs_info:*' enable git cvs svn hg bzr
- # vcs_info also needs to be in precmd, see: 10_hooks
- vcs_info
+ unset PS1 PS2 PS3 PS4 PROMPT RPROMPT
# Colours accepted as arguments
- local u_col=${1:-'green'}
- local h_col=${2:-'green'}
- local d_col=${3:-'blue'}
- local n_tru=${4:-'blue'}
- local n_fal=${5:-'yellow'}
- # looks like: ee1mpf@eepc-tsar16 ~ $
- ps1=(
- # "%{$fg_bold[$u_col]%}%n@"
- # "%{$fg_bold[$h_col]%}%m "
- "%{$fg_bold[$d_col]%}%1~%{$reset_color%}" # end of path
- "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%} %{$reset_color%}"
- '${vcs_info_msg_0_}'
- "%{%(?.$fg_bold[$n_tru].$fg_bold[$n_fal])%}$ "
- "%{$reset_color%}"
- )
- ps2=(
- "%_ %{$fg_bold[$d_col]%}-> "
- "%{$reset_color%}"
- )
- PS2="${(j::)ps2}"
- PS1="${(j::)ps1}"
+ d_col=${3:-'blue'}
+ n_tru=${4:-'blue'}
+ n_fal=${5:-'red'}
+ # I've no idea why the %F style colours don't work whhen SHLVL == 1
+ if [[ $SHLVL == 1 ]]; then
+ PS1='$fg_bold[$d_col]%1~ $fg_bold[yellow]${vcs_info_msg_0_}%(?.$fg_bold[$n_tru].$fg[$n_fal])$ $reset_color'
+ PS2='%_ $fg_bold{$d_col}-> %reset_color'
+ else
+ PS1='%B%F{$d_col}%1~ %F{yellow}${vcs_info_msg_0_}%(?.%F{$n_tru}.%F{$n_fal})$ %F{white}'
+ PS2='%_ %B%F{$d_col}-> %F{white}'
+ fi
}
# print information when user runs 'prompt -h git'
View
9 rc
@@ -69,6 +69,15 @@ compinit
autoload -Uz colors
colors
+
+autoload -Uz vcs_info
+zstyle ':vcs_info:*' formats '%b '
+zstyle ':vcs_info:(svn|bzr):*' branchformat '%b:%r'
+zstyle ':vcs_info:*' enable git cvs svn hg bzr
+# vcs_info also needs to be in precmd, see: 10_hooks
+vcs_info
+
+
# Needed for doc function in 03_help.
compdef _doc doc
Please sign in to comment.
Something went wrong with that request. Please try again.