From c3e48bbacb629dc5acd719c14023265b819050e0 Mon Sep 17 00:00:00 2001 From: Kyle West Date: Mon, 30 Jan 2012 23:20:38 -0500 Subject: [PATCH 01/10] added directories and code for custom zsh configuration. --- custom/zsh/README.markdown | 0 zsh/zshrc | 59 ++++++++++++++++++++------------------ 2 files changed, 31 insertions(+), 28 deletions(-) create mode 100644 custom/zsh/README.markdown diff --git a/custom/zsh/README.markdown b/custom/zsh/README.markdown new file mode 100644 index 0000000..e69de29 diff --git a/zsh/zshrc b/zsh/zshrc index 88775bd..913d4c9 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -1,34 +1,50 @@ +# -------------------------------- +# +# DO NOT EDIT THIS FILE. +# If you want to make changes, do so in the custom/zsh directory. +# Fork and send pull requests to add features and fix bugs. Thanks! +# +# ================================ + +# Don't change. The following determines where YADR is installed. +yadr=`find -L ~ -type file -maxdepth 2 -name .yadr | head | sed 's:\.yadr\/::'` + # Source oh-my-zsh if it is installed. if [[ -d $HOME/.oh-my-zsh ]]; then # Path to your oh-my-zsh configuration. ZSH=$HOME/.oh-my-zsh # Set name of the theme to load. - ZSH_THEME="skwp" + ZSH_THEME="robbyrussell" - # 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 rvm ruby rails autojump) + # Default plugins. + plugins=(brew git github ruby) - # Load default oh-my-zsh stuff + # source every zsh file in user's custom/zsh/before. This is useful for setting theme and plugins. + if [[ -d $yadr/custom/zsh/before/ ]]; then + for config_file ($yadr/custom/zsh/before/**/*.zsh) source $config_file + fi + + # Source oh-my-zsh source $ZSH/oh-my-zsh.sh fi -# Don't change. The following determines where YADR is installed. -yadr=`find -L ~ -type file -maxdepth 2 -name .yadr | head | sed 's:\.yadr\/::'` - # Configuration source $yadr/zsh/aliases source $yadr/zsh/zsh_aliases -# Things I don't want to publish to github -source ~/.secrets +# ------------------ +# zsh/after +# ================== +# source every zsh file in user's custom/zsh/after. +if [[ -d $yadr/custom/zsh/after/ ]]; then + for config_file ($yadr/custom/zsh/after/**/*.zsh) source $config_file +fi -# Vim mode -bindkey -v - -# Give me my bash style incremental search -bindkey '^R' history-incremental-search-backward +# Put secret configuration settings in ~/.secrets +if [[ -a ~/.secrets ]] then + source ~/.secrets +fi # Speed up git completion # http://talkings.org/post/5236392664/zsh-and-slow-git-completion @@ -36,16 +52,3 @@ __git_files () { _wanted files expl 'local files' _files } -# Always pushd when changing directory -setopt auto_pushd - -# Fuzzy matching of completions for when you mistype them: -zstyle ':completion:*' completer _complete _match _approximate -zstyle ':completion:*:match:*' original only -zstyle ':completion:*:approximate:*' max-errors 1 numeric - -# RVM -[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" - -# Add path to our custom bins -export PATH=$PATH:$yadr/bin:$yadr/bin/yadr From 1d529ab91b0a9ce8453d8c35969e15f8da93e3cc Mon Sep 17 00:00:00 2001 From: Kyle West Date: Mon, 30 Jan 2012 23:22:25 -0500 Subject: [PATCH 02/10] adding sample zsh configs. --- custom/zsh/after.sample/sample.zsh | 0 custom/zsh/before.sample/sample.zsh | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 custom/zsh/after.sample/sample.zsh create mode 100644 custom/zsh/before.sample/sample.zsh diff --git a/custom/zsh/after.sample/sample.zsh b/custom/zsh/after.sample/sample.zsh new file mode 100644 index 0000000..e69de29 diff --git a/custom/zsh/before.sample/sample.zsh b/custom/zsh/before.sample/sample.zsh new file mode 100644 index 0000000..e69de29 From b76f3965728f4d7fc23ae2d83435e4ad02c3682c Mon Sep 17 00:00:00 2001 From: Kyle West Date: Mon, 30 Jan 2012 23:27:52 -0500 Subject: [PATCH 03/10] updated .gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 8bb8c59..e3721f5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -.DS_Store +custom/zsh/before +custom/zsh/after + vim/backups vim/view *un~ From f8adde9e052449294e1ec856574fbafc0b7f9fdf Mon Sep 17 00:00:00 2001 From: Kyle West Date: Mon, 30 Jan 2012 23:39:20 -0500 Subject: [PATCH 04/10] automatically load RVM or rbenv. --- zsh/zshrc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/zsh/zshrc b/zsh/zshrc index 913d4c9..832e745 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -33,6 +33,26 @@ fi source $yadr/zsh/aliases source $yadr/zsh/zsh_aliases +# RVM / rbenv +if [[ -d ~/.rvm/ ]] && [[ -d ~/.rbenv/ ]]; then + # TODO: colorize + echo '***************************************************************' + echo 'ERROR!' + echo 'YADR found both ~/.rvm and ~/.rbenv directories. You cannot use' + echo 'RVM and rbenv simultaneously. Please delete one and reload zsh.' + echo '***************************************************************' + 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 + # ------------------ # zsh/after # ================== From 228d89ec38c8cb73a3637946f1e87d0b6e4b034b Mon Sep 17 00:00:00 2001 From: Kyle West Date: Mon, 30 Jan 2012 23:46:41 -0500 Subject: [PATCH 05/10] 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 From f6549f64f8e9cb440e6609b595e14fa550cad168 Mon Sep 17 00:00:00 2001 From: Kyle West Date: Tue, 31 Jan 2012 12:21:57 -0500 Subject: [PATCH 06/10] simplifying paths for zsh customization. --- custom/{zsh => zsh.sample}/README.markdown | 0 .../sample.zsh => zsh.sample/after.sample.zsh} | 0 .../sample.zsh => zsh.sample/before.sample.zsh} | 0 zsh/zshrc | 8 ++++---- 4 files changed, 4 insertions(+), 4 deletions(-) rename custom/{zsh => zsh.sample}/README.markdown (100%) rename custom/{zsh/after.sample/sample.zsh => zsh.sample/after.sample.zsh} (100%) rename custom/{zsh/before.sample/sample.zsh => zsh.sample/before.sample.zsh} (100%) diff --git a/custom/zsh/README.markdown b/custom/zsh.sample/README.markdown similarity index 100% rename from custom/zsh/README.markdown rename to custom/zsh.sample/README.markdown diff --git a/custom/zsh/after.sample/sample.zsh b/custom/zsh.sample/after.sample.zsh similarity index 100% rename from custom/zsh/after.sample/sample.zsh rename to custom/zsh.sample/after.sample.zsh diff --git a/custom/zsh/before.sample/sample.zsh b/custom/zsh.sample/before.sample.zsh similarity index 100% rename from custom/zsh/before.sample/sample.zsh rename to custom/zsh.sample/before.sample.zsh diff --git a/zsh/zshrc b/zsh/zshrc index 1666837..2afbe7d 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -21,8 +21,8 @@ if [[ -d $HOME/.oh-my-zsh ]]; then plugins=(brew git github ruby) # source every zsh file in user's custom/zsh/before. This is useful for setting theme and plugins. - if [[ -d $yadr/custom/zsh/before/ ]]; then - for config_file ($yadr/custom/zsh/before/**/*.zsh) source $config_file + if [[ -d $yadr/custom/zsh/ ]]; then + for config_file ($yadr/custom/zsh/**/*.before.zsh) source $config_file fi # Source oh-my-zsh @@ -54,8 +54,8 @@ fi # zsh/after # ================== # source every zsh file in user's custom/zsh/after. -if [[ -d $yadr/custom/zsh/after/ ]]; then - for config_file ($yadr/custom/zsh/after/**/*.zsh) source $config_file +if [[ -d $yadr/custom/zsh/ ]]; then + for config_file ($yadr/custom/zsh/**/*.after.zsh) source $config_file fi # Put secret configuration settings in ~/.secrets From 23a86aded510c0f4a42553d5769e80f85b7d3d46 Mon Sep 17 00:00:00 2001 From: Kyle West Date: Tue, 31 Jan 2012 12:27:29 -0500 Subject: [PATCH 07/10] updated .gitignore for new zsh paths. --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index e3721f5..5f484d5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ -custom/zsh/before -custom/zsh/after +custom/zsh vim/backups vim/view From 435776f272549eb9b2791a5799cdf20959b8efd4 Mon Sep 17 00:00:00 2001 From: Kyle West Date: Thu, 1 Mar 2012 16:19:34 -0500 Subject: [PATCH 08/10] Removed brew and github plugins. ZSH was becoming slow. Research suggested these plugins were to blame. http://superuser.com/questions/236953/zsh-starts-incredibly-slowly --- zsh/zshrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsh/zshrc b/zsh/zshrc index 2afbe7d..2181816 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -18,7 +18,7 @@ if [[ -d $HOME/.oh-my-zsh ]]; then ZSH_THEME="robbyrussell" # Default plugins. - plugins=(brew git github ruby) + plugins=(git ruby) # source every zsh file in user's custom/zsh/before. This is useful for setting theme and plugins. if [[ -d $yadr/custom/zsh/ ]]; then From 1aa9e5b87581d784688cdd711f332b74f0c45877 Mon Sep 17 00:00:00 2001 From: Kyle West Date: Thu, 22 Mar 2012 16:15:42 -0400 Subject: [PATCH 09/10] Only init fasd if it is installed. --- zsh/fasd.zsh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/zsh/fasd.zsh b/zsh/fasd.zsh index 2ff4808..84974a5 100644 --- a/zsh/fasd.zsh +++ b/zsh/fasd.zsh @@ -1,13 +1,16 @@ -# Initialize fasd (https://github.com/clvv/fasd) -eval "$(fasd --init posix-alias zsh-hook)" +# only init if installed. +if [[ -d $HOME/.fasd ]]; then + # Initialize fasd (https://github.com/clvv/fasd) + eval "$(fasd --init posix-alias zsh-hook)" -# aliases + # aliases -# jump to recently used items -alias a='fasd -a' # any -alias s='fasd -s' # show / search / select -alias d='fasd -d' # directory -alias f='fasd -f' # file -alias z='fasd_cd -d' # cd, same functionality as j in autojump -alias v='f -e vim' # quick opening files with vim + # jump to recently used items + alias a='fasd -a' # any + alias s='fasd -s' # show / search / select + alias d='fasd -d' # directory + alias f='fasd -f' # file + alias z='fasd_cd -d' # cd, same functionality as j in autojump + alias v='f -e vim' # quick opening files with vim +fi From 23e76cab12bc493a2b874579ee49defd3226283b Mon Sep 17 00:00:00 2001 From: Kyle West Date: Fri, 23 Mar 2012 14:02:58 -0400 Subject: [PATCH 10/10] Documentation for customizing ZSH. --- README.md | 15 +++++++++++++++ custom/zsh.sample/README.markdown | 0 custom/zsh.sample/after.sample.zsh | 20 ++++++++++++++++++++ custom/zsh.sample/before.sample.zsh | 16 ++++++++++++++++ 4 files changed, 51 insertions(+) delete mode 100644 custom/zsh.sample/README.markdown diff --git a/README.md b/README.md index 134675e..ed1634a 100644 --- a/README.md +++ b/README.md @@ -172,6 +172,21 @@ mnemonic aliases. Please feel free to edit them: * Bash style ctrl-R for reverse history finder * Fuzzy matching - if you mistype a directory name, tab completion will fix it +### How To Customize ZSH + +YADR allows you to completely customize your ZSH without having to fork and maintain the project. Here's how it works: YADR will +source (include) any files matching the pattern `*.before.zsh` or `*.after.zsh` in the `custom/zsh` directory. `before` files are +useful for setting the theme and plugins. `after` files allow you to override options set by YADR, define your own aliases, etc. + +To make your life easier, create a `zsh` folder in your Dropbox (or as a git repo) and symlink it into `~/.yadr/custom`. Do it like this: + +```bash +ln -s ~/Dropbox/path/to/zsh ~/.yadr/custom/zsh +``` + +Create as many `whatever.before.zsh` or `whatever.after.zsh` files as you need within the `zsh` directory. Please see `custom/zsh.sample` for +an example. + ## Pry diff --git a/custom/zsh.sample/README.markdown b/custom/zsh.sample/README.markdown deleted file mode 100644 index e69de29..0000000 diff --git a/custom/zsh.sample/after.sample.zsh b/custom/zsh.sample/after.sample.zsh index e69de29..a3a8078 100644 --- a/custom/zsh.sample/after.sample.zsh +++ b/custom/zsh.sample/after.sample.zsh @@ -0,0 +1,20 @@ +# +# Samples of what you can do in *.after.zsh files. +# You can create as many files as you like, or put everything in one. +# + +# define your own aliases or override those provided by YADR. +alias ls='ls -lAhFG' +alias hosts='sudo vim /private/etc/hosts' + + +# set or override options. two of my favorite are below. + + +# Automatically cd to frequently used directories http://robots.thoughtbot.com/post/10849086566/cding-to-frequently-used-directories-in-zsh +setopt auto_cd +cdpath=($HOME/Dropbox/code) + +# Fancy globbing http://linuxshellaccount.blogspot.com/2008/07/fancy-globbing-with-zsh-on-linux-and.html +setopt extendedglob + diff --git a/custom/zsh.sample/before.sample.zsh b/custom/zsh.sample/before.sample.zsh index e69de29..c171f66 100644 --- a/custom/zsh.sample/before.sample.zsh +++ b/custom/zsh.sample/before.sample.zsh @@ -0,0 +1,16 @@ +# +# Samples of what you can do in *.before.zsh files. +# You can create as many files as you like, or put everything in one. +# + +# append your own plugins. the $plugins at the end includes the plugins +# defined by YADR. +plugins=(osx ruby vagrant $plugins) + +# ignore plugins defined by YADR and use your own list. Notice there is no +# $plugins at the end. +plugins=(osx ruby vagrant) + +# set your theme. +export ZSH_THEME="kennethreitz" +