Last active
August 29, 2015 14:27
-
-
Save Birch-san/ef010caf170a74353d2f to your computer and use it in GitHub Desktop.
My customizations to .zshrc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*) | |
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/ | |
# Example format: plugins=(rails git textmate ruby lighthouse) | |
# Add wisely, as too many plugins slow down shell startup. | |
plugins=(git sublime jsontools zsh-syntax-highlighting) | |
######## | |
#http://superuser.com/questions/541366/way-to-move-cursor-by-arguments-in-bash | |
function move_word { | |
local direction=$1 | |
buffer=$BUFFER | |
words=${(z)buffer} | |
index=1 | |
old_index=0 | |
for word in $words[@] | |
do | |
if [[ ! ${buffer} =~ ${${(q)word}:gs#\\\'#\'#} ]] | |
then | |
echo "Something strange happened... no match for current word $word in $buffer" | |
return 1 | |
fi | |
old_length=${#buffer} | |
buffer=${buffer[$MEND,-1]} | |
new_length=${#buffer} | |
index=$(($index + $old_length - $new_length)) | |
case "$direction" in | |
forward) | |
if [[ $old_index -le $CURSOR && $index -gt $CURSOR ]] | |
then | |
CURSOR=$index | |
return | |
fi | |
;; | |
backward) | |
if [[ $old_index -lt $CURSOR && $index -ge $CURSOR ]] | |
then | |
CURSOR=$old_index | |
return | |
fi | |
;; | |
esac | |
old_index=$index | |
done | |
case "$direction" in | |
forward) | |
CURSOR=${#BUFFER} | |
;; | |
backward) | |
CURSOR=0 | |
;; | |
esac | |
} | |
function move_forward_word { | |
move_word "forward" | |
} | |
function move_backward_word { | |
move_word "backward" | |
} | |
zle -N my_move_backwards move_backward_word | |
zle -N my_move_forwards move_forward_word | |
bindkey '^[[1;6D' my_move_backwards | |
bindkey '^[[1;6C' my_move_forwards | |
######## | |
export PATH="$PATH:$HOME/git/bf-php/vendor/bin/" # Add phpunit to PATH | |
source ~/.bash_profile | |
source ~/.profile | |
######## | |
vshow() { git show "$1" | vim - "+set filetype=${1##*.}"; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Word-navigation credit to Matthew Franglen:
http://superuser.com/questions/541366/way-to-move-cursor-by-arguments-in-bash
vshow
alias credit to Olivier Gay:https://twitter.com/oliviergay/status/179692941063888896
It is a
git show
alias which recruits vim as pager, using vim's default syntax highlighting.zsh-syntax-highlighting
confers shell highlighting.https://github.com/zsh-users/zsh-syntax-highlighting