Merge remote-tracking branch 'sjl/master'

Conflicts:
	.gitignore
	lib/directories.zsh
	lib/functions.zsh
	lib/git.zsh
	templates/zshrc.zsh-template
This commit is contained in:
Shawn Sorichetti 2011-06-03 16:56:06 -04:00
commit 2f046e7e4a
9 changed files with 36 additions and 64 deletions

8
.gitignore vendored
View file

@ -1,7 +1,9 @@
locals.zsh locals.zsh
log/.zsh_history log/.zsh_history
projects.zsh projects.zsh
custom/* custom
!custom/example custom/*.zsh
!custom/example.zsh *.un~
cache cache
.DS_Store

View file

@ -1,2 +0,0 @@
# Add your own custom plugins in the custom/plugins directory. Plugins placed
# here will override ones with the same name in the main plugins directory.

View file

@ -1,25 +0,0 @@
# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'
# Basic directory operations
alias ...='cd ../..'
alias -- -='cd -'
# Super user
alias _='sudo'
#alias g='grep -in'
# Show history
alias history='fc -l 1'
# List direcory contents
alias lsa='ls -lah'
alias l='ls -la'
alias ll='ls -l'
alias sl=ls # often screw this up
alias afind='ack-grep -il'
alias x=extract

View file

@ -28,13 +28,6 @@ alias md='mkdir -p'
alias rd=rmdir alias rd=rmdir
alias d='dirs -v' alias d='dirs -v'
# mkdir & cd to it
function mcd() {
mkdir -p "$1" && cd "$1";
}
alias d='dirs -v'
# List direcory contents # List direcory contents
alias l1='tree --dirsfirst -ChFL 1' alias l1='tree --dirsfirst -ChFL 1'
alias l2='tree --dirsfirst -ChFL 2' alias l2='tree --dirsfirst -ChFL 2'
@ -46,3 +39,8 @@ alias ll3='tree --dirsfirst -ChFupDaL 3'
alias l='l1' alias l='l1'
alias ll='ll1' alias ll='ll1'
# mkdir & cd to it
function mcd() {
mkdir -p "$1" && cd "$1";
}

View file

@ -10,11 +10,6 @@ function upgrade_oh_my_zsh() {
/bin/sh $ZSH/tools/upgrade.sh /bin/sh $ZSH/tools/upgrade.sh
} }
function take() {
mkdir -p $1
cd $1
}
function extract() { function extract() {
unset REMOVE_ARCHIVE unset REMOVE_ARCHIVE

View file

@ -4,12 +4,19 @@ function git_prompt_info() {
echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX" echo "$ZSH_THEME_GIT_PROMPT_PREFIX${ref#refs/heads/}$(parse_git_dirty)$ZSH_THEME_GIT_PROMPT_SUFFIX"
} }
# Checks if working tree is dirty
parse_git_dirty () { parse_git_dirty () {
if [[ -n $(git status -s 2> /dev/null) ]]; then gitstat=$(git status 2>/dev/null | grep '\(# Untracked\|# Changes\|# Changed but not updated:\)')
echo "$ZSH_THEME_GIT_PROMPT_DIRTY"
else if [[ $(echo ${gitstat} | grep -c "^# Changes to be committed:$") > 0 ]]; then
echo "$ZSH_THEME_GIT_PROMPT_CLEAN" 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} | grep -v '^$' | wc -l | tr -d ' ') == 0 ]]; then
echo -n "$ZSH_THEME_GIT_PROMPT_CLEAN"
fi fi
} }
@ -20,6 +27,15 @@ function git_prompt_ahead() {
fi fi
} }
#
# Will return the current branch name
# Usage example: git pull origin $(current_branch)
#
function current_branch() {
ref=$(git symbolic-ref HEAD 2> /dev/null) || return
echo ${ref#refs/heads/}
}
# Formats prompt string for current git commit short SHA # Formats prompt string for current git commit short SHA
function git_prompt_short_sha() { function git_prompt_short_sha() {
SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER" SHA=$(git rev-parse --short HEAD 2> /dev/null) && echo "$ZSH_THEME_GIT_PROMPT_SHA_BEFORE$SHA$ZSH_THEME_GIT_PROMPT_SHA_AFTER"

View file

@ -25,21 +25,6 @@ bindkey "^[[3~" delete-char
bindkey "^[3;5~" delete-char bindkey "^[3;5~" delete-char
bindkey "\e[3~" delete-char bindkey "\e[3~" delete-char
# consider emacs keybindings:
#bindkey -e ## emacs key bindings
#
#bindkey '^[[A' up-line-or-search
#bindkey '^[[B' down-line-or-search
#bindkey '^[^[[C' emacs-forward-word
#bindkey '^[^[[D' emacs-backward-word
#
#bindkey -s '^X^Z' '%-^M'
#bindkey '^[e' expand-cmd-path
#bindkey '^[^I' reverse-menu-complete
#bindkey '^X^N' accept-and-infer-next-history
#bindkey '^W' kill-region
#bindkey '^I' complete-word
## Fix weird sequence that rxvt produces ## Fix weird sequence that rxvt produces
#bindkey -s '^[[Z' '\t' #bindkey -s '^[[Z' '\t'
# #

View file

@ -5,7 +5,7 @@ export ZSH=$HOME/.oh-my-zsh
# Look in ~/.oh-my-zsh/themes/ # Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each # Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded. # time that oh-my-zsh is loaded.
export ZSH_THEME="robbyrussell" export ZSH_THEME="prose"
# Set to this to use case-sensitive completion # Set to this to use case-sensitive completion
# export CASE_SENSITIVE="true" # export CASE_SENSITIVE="true"

View file

@ -27,3 +27,6 @@ ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!" ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[green]%}!"
ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?" ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[green]%}?"
ZSH_THEME_GIT_PROMPT_CLEAN="" ZSH_THEME_GIT_PROMPT_CLEAN=""
local return_status="%{$fg[red]%}%(?..⏎)%{$reset_color%}"
RPROMPT='${return_status}%{$reset_color%}'