files from dotfiles

This commit is contained in:
Robin Wenglewski 2011-09-08 10:48:39 +02:00
commit 7ccf4603a5
12 changed files with 244 additions and 0 deletions

3
Rakefile Normal file
View file

@ -0,0 +1,3 @@
task :setup do
%x(ln -sf ~/.zsh/zshrc ~/.zshrc)
end

34
aliases.zsh Normal file
View file

@ -0,0 +1,34 @@
# ls
alias l="ls -FG"
alias ls="ls -FG"
alias la="l -lAh"
alias e="$EDITOR"
# git
alias g='git'
alias gl='git pull'
alias gp='git push'
alias gph='gp && gp heroku'
alias gd='git diff'
alias gc='git clone'
alias gco='git checkout'
alias gb='git branch'
alias gs='git status'
alias grm="git status | grep deleted | awk '{print \$3}' | xargs git rm"
alias gca='grm; git add .;gs;read;git commit'
alias git-authors='git shortlog -s -n'
# alias changelog='git log `git log -1 --format=%H -- CHANGELOG*`..; cat CHANGELOG*'
# alias gf='git flow'
# rails
alias r="rails"
alias a='autotest -rails'
alias tlog='tail -f log/development.log'
alias rst='touch tmp/restart.txt'
alias bist="bundle install"
# commands starting with % for pasting from web
alias %=' '
alias sleepmac="osascript -e 'tell application \"System Events\" to sleep'"

8
completion.zsh Normal file
View file

@ -0,0 +1,8 @@
autoload -U compinit
compinit
# matches case insensitive for lowercase
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'
# pasting with tabs doesn't perform completion
zstyle ':completion:*' insert-tab pending

78
config.zsh Normal file
View file

@ -0,0 +1,78 @@
# if [[ -n $SSH_CONNECTION ]]; then
# export PS1='%m:%3~$(git_info_for_prompt)%# '
# else
# export PS1='%3~$(git_info_for_prompt)%# '
# fi
if (( ${+commands[mvim]} ));then
export EDITOR='mvim'
elif (( ${+commands[mate]} ));then
export EDITOR="mate"
else
export EDITOR='vim'
fi
# uncommented since this is system dependent
# export PATH="$HOME/bin:$HOME/.bin:/usr/local/homebrew/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/local/git/bin:$PATH"
# export MANPATH="/usr/local/man:/usr/local/mysql/man:/usr/local/git/man:$MANPATH"
#
# uncommented since this is system dependent (caused error on configure nginx on my server)
# export CC=gcc-4.2
# LANG is required by some programs, like ruby, so ensure that it is set (to UTF)
export LANG=en_US.UTF-8
if [[ -e /usr/libexec/java_home ]]; then
export JAVA_HOME="`/usr/libexec/java_home`"
fi
fpath=(~/.zsh/functions $fpath)
autoload -U ~/.zsh/functions/*(:t)
#HISTFILE=~/.zsh_history
#HISTSIZE=1000
#SAVEHIST=1000
#REPORTTIME=10 # print elapsed time when more than 10 seconds
#setopt NO_BG_NICE # don't nice background tasks
#setopt NO_HUP
#setopt NO_LIST_BEEP
#setopt LOCAL_OPTIONS # allow functions to have local options
#setopt LOCAL_TRAPS # allow functions to have local traps
#setopt HIST_VERIFY
## setopt SHARE_HISTORY # share history between sessions ???
unsetopt EXTENDED_HISTORY # add timestamps to history
#setopt PROMPT_SUBST
#setopt CORRECT
#setopt COMPLETE_IN_WORD
#setopt IGNORE_EOF
#setopt AUTOCD # change to directory without "cd"
#setopt APPEND_HISTORY # adds history
#setopt INC_APPEND_HISTORY # SHARE_HISTORY # adds history incrementally and share it across sessions
#setopt HIST_IGNORE_ALL_DUPS # don't record dupes in history
#setopt HIST_REDUCE_BLANKS
#zle -N newtab
#bindkey '^[^[[D' backward-word
#bindkey '^[^[[C' forward-word
#bindkey '^[[5D' beginning-of-line
#bindkey '^[[5C' end-of-line
#bindkey '^[[3~' delete-char
#bindkey '^[^N' newtab
#bindkey '^?' backward-delete-char
#bindkey '\e[3~' delete-char
# reverse everything above and set it to default vim key-binding
#bindkey -e
## bindkey '' history-incremental-search-backward
#bindkey '' backward-word
#bindkey '' forward-word
# ctrl-< and crtrl-> still works
# rvm, should be at the end of this config file
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.

10
functions.zsh Normal file
View file

@ -0,0 +1,10 @@
function title {
if [ "$TAB_TITLE" != "" ];then 1=$TAB_TITLE;fi
[ "$DISABLE_AUTO_TITLE" != "true" ] || return
if [[ "$TERM" == screen* ]]; then
print -Pn "\ek$1:q\e\\" #set screen hardstatus, usually truncated at 20 chars
elif [[ "$TERM" == xterm* ]] || [[ $TERM == rxvt* ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then
print -Pn "\e]2;$2:q\a" #set window name
print -Pn "\e]1;$1:q\a" #set icon (=tab) name (will override window name on broken terminal)
fi
}

2
functions/_c Normal file
View file

@ -0,0 +1,2 @@
#compdef c
_files -W ~/code -/

2
functions/_d Normal file
View file

@ -0,0 +1,2 @@
#compdef d
_files -W ~/Dropbox -/

1
functions/c Normal file
View file

@ -0,0 +1 @@
cd ~/code/$1;

1
functions/d Normal file
View file

@ -0,0 +1 @@
cd ~/Dropbox/$1;

View file

@ -0,0 +1,5 @@
zstyle ':completion:*' verbose yes
zstyle ':completion:*:descriptions' format '%B%d%b'
zstyle ':completion:*:messages' format '%d'
zstyle ':completion:*:warnings' format 'No matches for: %d'
zstyle ':completion:*' group-name ''

54
git_aliases Normal file
View file

@ -0,0 +1,54 @@
export git_concise_log_format='--pretty=format:%Cblue%h%d%Creset %ar %Cgreen%an%Creset %s'
git_current_branch() {
git symbolic-ref HEAD 2> /dev/null | sed -e 's/refs\/heads\///'
}
alias ga='git add'
alias gap='ga -p'
alias gau='git add -u'
alias gbr='git branch -v'
gc() {
git diff --cached | grep '\btap[ph]\b' >/dev/null &&
echo "\e[0;31;29mOops, there's a #tapp or similar in that diff.\e[0m" ||
git commit -v "$@"
}
alias gc!='git commit -v'
alias gca='git commit -v -a'
alias gcam='gca --amend'
alias gch='git cherry-pick'
alias gcm='git commit -v --amend'
alias gco='git checkout'
alias gcop='gco -p'
alias gd='git diff -M'
alias gd.='git diff -M --color-words="."'
alias gdc='git diff --cached -M'
alias gdc.='git diff --cached -M --color-words="."'
alias gf='git fetch'
alias glog='git log $git_concise_log_format'
alias gl='glog --graph'
alias gla='gl --all'
alias gl_absolute='git log --pretty=format:"%Cblue%h%d%Creset %ad %Cgreen%an%Creset %s"'
gls() {
query="$1"
shift
glog --pickaxe-regex "-S$query" "$@"
}
alias gm='git merge --no-ff'
alias gmf='git merge --ff-only'
alias gp='git push'
alias gpt='gp --tags'
alias gr='git reset'
alias grb='git rebase -p'
alias grbc='git rebase --continue'
alias grbi='git rebase -i'
alias grh='git reset --hard'
alias grp='gr --patch'
alias grsh='git reset --soft HEAD~'
alias grv='git remote -v'
alias gs='git show'
alias gs.='git show --color-words="."'
alias gst='git stash'
alias gstp='git stash pop'
alias gup='git smart-pull'
alias graf='git remote add $argv[1] $argv[2] && gf $argv[1]'

46
zshrc Executable file
View file

@ -0,0 +1,46 @@
# source global profile if exists. This is important, since in /etc/profile the /etc/profile.d/* files are sourced.
# These usually contain additional path variables and other global settings
[[ -f /etc/profile ]] && . /etc/profile
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="robbyrussell"
# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
# Comment this out to disable weekly auto-update checks
# DISABLE_AUTO_UPDATE="true"
# Uncomment following line if you want to disable colors in ls
# DISABLE_LS_COLORS="true"
# Uncomment following line if you want to disable autosetting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment following line if you want disable red dots displayed while waiting for completion
# DISABLE_COMPLETION_WAITING_DOTS="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git rails ruby brew bundler cap gem github osx pow powder rails3 rvm vagrant)
source $ZSH/oh-my-zsh.sh
# Customize to your needs...
alias h="dirs -v"
unalias d
RWZSH=$HOME/.zsh
. $RWZSH/config.zsh
. $RWZSH/aliases.zsh
. $RWZSH/completion.zsh
. $RWZSH/functions.zsh
# use .localrc for settings specific to one system
[[ -f ~/.localrc ]] && . ~/.localrc