Skip to content

Instantly share code, notes, and snippets.

@lenary

lenary/.zshrc Secret

Created May 31, 2010 00:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lenary/963f052b4122e1a66b82 to your computer and use it in GitHub Desktop.
Save lenary/963f052b4122e1a66b82 to your computer and use it in GitHub Desktop.
# Path to your oh-my-zsh configuration.
export ZSH=$HOME/.oh-my-zsh
# Set to the name theme to load.
# Look in ~/.oh-my-zsh/themes/
export ZSH_THEME="lenary"
# Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# export DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
export DISABLE_LS_COLORS="true"
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
if [[ -s ~/.rvm/scripts/rvm ]] ; then source ~/.rvm/scripts/rvm ; fi
# rvm use 1.8.7 2>/dev/null 1>/dev/null
function lenary_git_prompt_info() {
if [[ -d .git ]]; then
echo "$ZSH_THEME_GIT_PROMPT_PREFIX$(lenary_parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
fi
}
lenary_parse_git_dirty () {
ref=$(git symbolic-ref HEAD 2> /dev/null) || break
gitstat=$(git status 2>/dev/null | grep '\(# Untracked\|# Changes\|# Changed but not updated:\)')
if [[ $(echo ${gitstat} | grep -c "^# Changes to be committed:$") > 0 ]]; then
echo -n "$ZSH_THEME_GIT_PROMPT_DIRTY_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_DIRTY_SUFFIX"
fi
if [[ $(echo ${gitstat} | grep -c "^\(# Untracked files:\|# Changed but not updated:\)$") > 0 ]]; then
echo -n "$ZSH_THEME_GIT_PROMPT_UNTRACKED_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_UNTRACKED_SUFFIX"
fi
if [[ $(echo ${gitstat} | wc -l | tr -d ' ') == 0 ]]; then
echo -n "$ZSH_THEME_GIT_PROMPT_CLEAN_PREFIX${ref#refs/heads/}$ZSH_THEME_GIT_PROMPT_CLEAN_SUFFIX"
fi
}
ZSH_THEME_GIT_PROMPT_PREFIX="on %{$fg[magenta]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_DIRTY_PREFIX="{"
ZSH_THEME_GIT_PROMPT_DIRTY_SUFFIX="}"
ZSH_THEME_GIT_PROMPT_UNTRACKED_PREFIX="["
ZSH_THEME_GIT_PROMPT_UNTRACKED_SUFFIX="]"
ZSH_THEME_GIT_PROMPT_CLEAN_PREFIX="("
ZSH_THEME_GIT_PROMPT_CLEAN_SUFFIX="%)"
PROMPT='%{$fg[yellow]%}lenary%{$reset_color%} in %{$fg[green]%}${PWD/#$HOME/~}%{$reset_color%} $(lenary_git_prompt_info)using %{$fg[red]%}%{$(~/.rvm/bin/rvm-prompt i v)%}%{$reset_color%}
%(11D.☃.%{$fg[cyan]%}⚡)%{$reset_color%} '
PROMPT2='%_ %(11D.☃.%{$fg[cyan]%}⚡)%{$reset_color%} '
RPROMPT='%{$fg_bold[blue]%}%!%{$reset_color%}'
diff --git a/lib/completion.zsh b/lib/completion.zsh
index b627ef8..84efbbe 100644
--- a/lib/completion.zsh
+++ b/lib/completion.zsh
@@ -21,7 +21,7 @@ else
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
fi
-zstyle ':completion:*' list-colors ''
+# zstyle ':completion:*' list-colors ''
# should this be in keybindings?
bindkey -M menuselect '^o' accept-and-infer-next-history
diff --git a/lib/git.zsh b/lib/git.zsh
index 1d1d24d..43d77b0 100644
--- a/lib/git.zsh
+++ b/lib/git.zsh
@@ -5,10 +5,17 @@ function git_prompt_info() {
}
parse_git_dirty () {
- if [[ -n $(git status -s 2> /dev/null) ]]; then
- echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
- else
- echo "$ZSH_THEME_GIT_PROMPT_CLEAN"
+ gitstat=$(git status 2>/dev/null | grep '\(# Untracked\|# Changes\|# Changed but not updated:\)')
+ if [[ $(echo ${gitstat} | grep -c "^# Changes to be committed:$") > 0 ]]; then
+ echo -n "$ZSH_THEME_GIT_PROMPT_DIRTY"
+ fi
+
+ if [[ $(echo ${gitstat} | grep -c "^\(# Untracked files:\|# Changed but not updated:\)$") > 0 ]]; then
+ echo -n "$ZSH_THEME_GIT_PROMPT_UNTRACKED"
+ fi
+
+ if [[ $(echo ${gitstat} | wc -l | tr -d ' ') == 0 ]]; then
+ echo -n "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi
}
diff --git a/lib/rvm.zsh b/lib/rvm.zsh
deleted file mode 100644
index 597be1b..0000000
--- a/lib/rvm.zsh
+++ /dev/null
@@ -1,7 +0,0 @@
-# get the name of the branch we are on
-function rvm_prompt_info() {
- ruby_version=$(~/.rvm/bin/rvm-prompt 2> /dev/null) || return
- echo "($ruby_version)"
-}
-
-
diff --git a/oh-my-zsh.sh b/oh-my-zsh.sh
index a41f3d8..7e00f84 100644
--- a/oh-my-zsh.sh
+++ b/oh-my-zsh.sh
@@ -13,7 +13,7 @@ for config_file ($ZSH/custom/*.zsh) source $config_file
# Check for updates on initial load...
if [ "$DISABLE_AUTO_UPDATE" = "true" ]
then
- return
+ # return
else
/usr/bin/env zsh $ZSH/tools/check_for_upgrade.sh
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment