From 228d89ec38c8cb73a3637946f1e87d0b6e4b034b Mon Sep 17 00:00:00 2001 From: Kyle West Date: Mon, 30 Jan 2012 23:46:41 -0500 Subject: [PATCH] added zsh aliases. Moved other files but left symlinks for backwards compatibility. --- zsh/aliases | 120 +------------------------------------------ zsh/aliases.zsh | 119 ++++++++++++++++++++++++++++++++++++++++++ zsh/key-bindings.zsh | 34 ++++++++++++ zsh/zsh-aliases.zsh | 17 ++++++ zsh/zsh_aliases | 18 +------ zsh/zshrc | 5 +- 6 files changed, 173 insertions(+), 140 deletions(-) mode change 100644 => 120000 zsh/aliases create mode 100644 zsh/aliases.zsh create mode 100644 zsh/key-bindings.zsh create mode 100644 zsh/zsh-aliases.zsh mode change 100644 => 120000 zsh/zsh_aliases diff --git a/zsh/aliases b/zsh/aliases deleted file mode 100644 index 64ea284..0000000 --- a/zsh/aliases +++ /dev/null @@ -1,119 +0,0 @@ -# Aliases in this file are bash and zsh compatible - -# Don't change. The following determines where YADR is installed. -yadr=`find -L ~ -type file -maxdepth 2 -name .yadr | head | sed 's:\.yadr\/::'` - -# YADR support -alias yav='yadr vim-add-plugin' -alias yuv='yadr vim-update-plugins' -alias yip='yadr init-plugins' - -# PS -alias psg="ps aux | grep " -alias psr='ps aux | grep ruby' - -# Moving around -alias ..='cd ..' -alias cdb='cd -' - -# Show human friendly numbers and colors -alias df='df -h' -alias ll='ls -alGh' -alias ls='ls -Gh' -alias du='du -h -d 2' - -# show me files matching "ls grep" -alias lsg='ll | grep' - -# Alias Editing -alias ae='vi $yadr/zsh/aliases' #alias edit -alias ar='source $yadr/zsh/aliases' #alias reload - -# vimrc editing -alias ve='vi ~/.vimrc' - -# zsh profile editing -alias ze='vi ~/.zshrc' -alias zr='source ~/.zshrc' - -# Git Aliases -alias gs='git status' -alias gstsh='git stash' -alias gst='git stash' -alias gsh='git show' -alias gshw='git show' -alias gshow='git show' -alias gi='vi .gitignore' -alias gcm='git ci -m' -alias gcim='git ci -m' -alias gci='git ci' -alias gco='git co' -alias ga='git add -A' -alias guns='git unstage' -alias gunc='git uncommit' -alias gm='git merge' -alias gms='git merge --squash' -alias gam='git amend' -alias gr='git rebase' -alias gra='git rebase --abort' -alias grc='git rebase --continue' -alias gbi='git rebase --interactive' -alias gl='git l' -alias glg='git l' -alias glog='git l' -alias co='git co' -alias gf='git fetch' -alias gfch='git fetch' -alias gd='git diff' -alias gb='git b' -alias gdc='git diff --cached' -alias gpub='grb publish' -alias gtr='grb track' -alias gpl='git pull' -alias gplr='git pull --rebase' -alias gps='git push' -alias gpsh='git push' -alias gnb='git nb' # new branch aka checkout -b -alias grs='git reset' -alias grsh='git reset --hard' -alias gcln='git clean' -alias gclndf='git clean -df' -alias gsm='git submodule' -alias gsmi='git submodule init' -alias gsmu='git submodule update' -alias gt='git t' - -# Common shell functions -alias less='less -r' -alias tf='tail -f' -alias l='less' -alias lh='ls -alt | head' # see the last modified files -alias screen='TERM=screen screen' -alias cl='clear' -alias ps='ps aux' - -# Zippin -alias gz='tar -zcvf' - -# Ruby -alias c='script/console --irb=pry' -alias ms='mongrel_rails start' - -# Vim/ctags "mctags = make ctags", using the ruby specific version -# to save some time -alias mctags=~/.bin/run_tags.rb #'/opt/local/bin/ctags -Rf ./tags *' - -alias ka9='killall -9' -alias k9='kill -9' - -# This trick makes sudo understand all my aliases -alias sudo='sudo ' - -# Gem install -alias sgi='sudo gem install --no-ri --no-rdoc' - -# TODOS -# This uses NValt (NotationalVelocity alt fork) - http://brettterpstra.com/project/nvalt/ -# to find the note called 'todo' -alias todo='open nvalt://find/todo' - diff --git a/zsh/aliases b/zsh/aliases new file mode 120000 index 0000000..a56c775 --- /dev/null +++ b/zsh/aliases @@ -0,0 +1 @@ +aliases.zsh \ No newline at end of file diff --git a/zsh/aliases.zsh b/zsh/aliases.zsh new file mode 100644 index 0000000..64ea284 --- /dev/null +++ b/zsh/aliases.zsh @@ -0,0 +1,119 @@ +# Aliases in this file are bash and zsh compatible + +# Don't change. The following determines where YADR is installed. +yadr=`find -L ~ -type file -maxdepth 2 -name .yadr | head | sed 's:\.yadr\/::'` + +# YADR support +alias yav='yadr vim-add-plugin' +alias yuv='yadr vim-update-plugins' +alias yip='yadr init-plugins' + +# PS +alias psg="ps aux | grep " +alias psr='ps aux | grep ruby' + +# Moving around +alias ..='cd ..' +alias cdb='cd -' + +# Show human friendly numbers and colors +alias df='df -h' +alias ll='ls -alGh' +alias ls='ls -Gh' +alias du='du -h -d 2' + +# show me files matching "ls grep" +alias lsg='ll | grep' + +# Alias Editing +alias ae='vi $yadr/zsh/aliases' #alias edit +alias ar='source $yadr/zsh/aliases' #alias reload + +# vimrc editing +alias ve='vi ~/.vimrc' + +# zsh profile editing +alias ze='vi ~/.zshrc' +alias zr='source ~/.zshrc' + +# Git Aliases +alias gs='git status' +alias gstsh='git stash' +alias gst='git stash' +alias gsh='git show' +alias gshw='git show' +alias gshow='git show' +alias gi='vi .gitignore' +alias gcm='git ci -m' +alias gcim='git ci -m' +alias gci='git ci' +alias gco='git co' +alias ga='git add -A' +alias guns='git unstage' +alias gunc='git uncommit' +alias gm='git merge' +alias gms='git merge --squash' +alias gam='git amend' +alias gr='git rebase' +alias gra='git rebase --abort' +alias grc='git rebase --continue' +alias gbi='git rebase --interactive' +alias gl='git l' +alias glg='git l' +alias glog='git l' +alias co='git co' +alias gf='git fetch' +alias gfch='git fetch' +alias gd='git diff' +alias gb='git b' +alias gdc='git diff --cached' +alias gpub='grb publish' +alias gtr='grb track' +alias gpl='git pull' +alias gplr='git pull --rebase' +alias gps='git push' +alias gpsh='git push' +alias gnb='git nb' # new branch aka checkout -b +alias grs='git reset' +alias grsh='git reset --hard' +alias gcln='git clean' +alias gclndf='git clean -df' +alias gsm='git submodule' +alias gsmi='git submodule init' +alias gsmu='git submodule update' +alias gt='git t' + +# Common shell functions +alias less='less -r' +alias tf='tail -f' +alias l='less' +alias lh='ls -alt | head' # see the last modified files +alias screen='TERM=screen screen' +alias cl='clear' +alias ps='ps aux' + +# Zippin +alias gz='tar -zcvf' + +# Ruby +alias c='script/console --irb=pry' +alias ms='mongrel_rails start' + +# Vim/ctags "mctags = make ctags", using the ruby specific version +# to save some time +alias mctags=~/.bin/run_tags.rb #'/opt/local/bin/ctags -Rf ./tags *' + +alias ka9='killall -9' +alias k9='kill -9' + +# This trick makes sudo understand all my aliases +alias sudo='sudo ' + +# Gem install +alias sgi='sudo gem install --no-ri --no-rdoc' + +# TODOS +# This uses NValt (NotationalVelocity alt fork) - http://brettterpstra.com/project/nvalt/ +# to find the note called 'todo' +alias todo='open nvalt://find/todo' + diff --git a/zsh/key-bindings.zsh b/zsh/key-bindings.zsh new file mode 100644 index 0000000..a6b7332 --- /dev/null +++ b/zsh/key-bindings.zsh @@ -0,0 +1,34 @@ +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Zle-Builtins +# http://zsh.sourceforge.net/Doc/Release/Zsh-Line-Editor.html#Standard-Widgets + +bindkey -v # Use vi key bindings + +bindkey '\ew' kill-region # [Esc-w] - Kill from the cursor to the mark +bindkey -s '\el' 'ls\n' # [Esc-l] - run command: ls +bindkey -s '\e.' '..\n' # [Esc-.] - run command: .. (up directory) +bindkey '^r' history-incremental-search-backward # [Ctrl-r] - Search backward incrementally for a specified string. The string may begin with ^ to anchor the search to the beginning of the line. +bindkey '^[[5~' up-line-or-history # [PageUp] - Up a line of history +bindkey '^[[6~' down-line-or-history # [PageDown] - Down a line of history + +bindkey '^[[A' up-line-or-search # start typing + [Up-Arrow] - fuzzy find history forward +bindkey '^[[B' down-line-or-search # start typing + [Down-Arrow] - fuzzy find history backward + +bindkey '^[[H' beginning-of-line # [Home] - Go to beginning of line +bindkey '^[[1~' beginning-of-line # [Home] - Go to beginning of line +bindkey '^[OH' beginning-of-line # [Home] - Go to beginning of line +bindkey '^[[F' end-of-line # [End] - Go to end of line +bindkey '^[[4~' end-of-line # [End] - Go to end of line +bindkey '^[OF' end-of-line # [End] - Go to end of line + +bindkey ' ' magic-space # [Space] - do history expansion + +bindkey '^[[1;5C' forward-word # [Ctrl-RightArrow] - move forward one word +bindkey '^[[1;5D' backward-word # [Ctrl-LeftArrow] - move backward one word + +# Make the delete key (or Fn + Delete on the Mac) work instead of outputting a ~ +bindkey '^?' backward-delete-char # [Delete] - delete backward +bindkey '^[[3~' delete-char # [fn-Delete] - delete forward +bindkey '^[3;5~' delete-char +bindkey '\e[3~' delete-char + diff --git a/zsh/zsh-aliases.zsh b/zsh/zsh-aliases.zsh new file mode 100644 index 0000000..34c1c1f --- /dev/null +++ b/zsh/zsh-aliases.zsh @@ -0,0 +1,17 @@ +# Global aliases +alias -g ...='../..' +alias -g ....='../../..' +alias -g .....='../../../..' +alias -g C='| wc -l' +alias -g H='| head' +alias -g L="| less" +alias -g N="| /dev/null" +alias -g S='| sort' +alias -g G='| grep' # now you can do: ls foo G something + +# Functions +# +# (f)ind by (n)ame +# usage: fn foo +# to find all files containing 'foo' in the name +function fn() { ls **/*$1* } diff --git a/zsh/zsh_aliases b/zsh/zsh_aliases deleted file mode 100644 index 34c1c1f..0000000 --- a/zsh/zsh_aliases +++ /dev/null @@ -1,17 +0,0 @@ -# Global aliases -alias -g ...='../..' -alias -g ....='../../..' -alias -g .....='../../../..' -alias -g C='| wc -l' -alias -g H='| head' -alias -g L="| less" -alias -g N="| /dev/null" -alias -g S='| sort' -alias -g G='| grep' # now you can do: ls foo G something - -# Functions -# -# (f)ind by (n)ame -# usage: fn foo -# to find all files containing 'foo' in the name -function fn() { ls **/*$1* } diff --git a/zsh/zsh_aliases b/zsh/zsh_aliases new file mode 120000 index 0000000..93ecce6 --- /dev/null +++ b/zsh/zsh_aliases @@ -0,0 +1 @@ +zsh-aliases.zsh \ No newline at end of file diff --git a/zsh/zshrc b/zsh/zshrc index 832e745..1666837 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -30,8 +30,7 @@ if [[ -d $HOME/.oh-my-zsh ]]; then fi # Configuration -source $yadr/zsh/aliases -source $yadr/zsh/zsh_aliases +for config_file ($yadr/zsh/*.zsh) source $config_file # RVM / rbenv if [[ -d ~/.rvm/ ]] && [[ -d ~/.rbenv/ ]]; then @@ -44,11 +43,9 @@ if [[ -d ~/.rvm/ ]] && [[ -d ~/.rbenv/ ]]; then echo '' else if [[ -d ~/.rvm/ ]]; then - echo 'found RVM' [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" fi if [[ -d ~/.rbenv/ ]]; then - echo 'found rbenv' eval "$(rbenv init -)" fi fi