From 7cd251083d2207c1f19bec3fdd51d81cbf9b66f8 Mon Sep 17 00:00:00 2001 From: Bodaniel Jeanes Date: Mon, 22 Nov 2010 13:53:19 +1000 Subject: [PATCH] shell stuff --- shell/aliases.sh | 7 ++++--- shell/common.sh | 2 +- shell/functions.sh | 17 +++++++++++++++++ shell/git.sh | 5 ++++- shell/osx.sh | 5 ++++- shell/prompt.sh | 2 +- zsh/config.zsh | 22 ++++++++++++++++++++-- 7 files changed, 51 insertions(+), 9 deletions(-) diff --git a/shell/aliases.sh b/shell/aliases.sh index 6b3f798..53fa89c 100644 --- a/shell/aliases.sh +++ b/shell/aliases.sh @@ -9,10 +9,11 @@ alias top='top -o cpu' alias et="$EDITOR ." alias sprof="reload" +alias eprof="$EDITOR $HOME/.config" alias home="cd $HOME" # the tilde is too hard to reach -alias systail='tail -f -n0 /var/log/system.log' -alias aptail='tail -f -n0 /var/log/apache*/*log' +alias systail='tail -fn0 /var/log/system.log' +alias aptail='tail -fn0 /var/log/apache*/*log' alias l='ls' alias b='cd -' @@ -22,7 +23,7 @@ alias c='clear' # shortcut to clear your terminal alias profileme="history | awk '{print \$2}' | awk 'BEGIN{FS=\"|\"}{print \$1}' | sort | uniq -c | sort -n | tail -n 20 | sort -nr" # rails stuff -alias log='tail -f -0 ./log/*.log' +alias log='tail -fn0 ./log/*.log /var/log/apache*/*log' alias ss='ruby ./script/server' alias sc='ruby ./script/console' alias gen='script/generate' diff --git a/shell/common.sh b/shell/common.sh index 5a0e630..4100bf5 100644 --- a/shell/common.sh +++ b/shell/common.sh @@ -1,4 +1,4 @@ -PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/mongodb/bin:/usr/local/pgsql/bin:/usr/X11/bin:/opt/local/bin:${PATH}" +PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/mongodb/bin:/usr/local/pgsql/bin:/usr/X11/bin:/opt/local/bin:${PATH}" CDPATH=".:${HOME}" source $DOT_FILES/$CURRENT_SHELL/config.*sh diff --git a/shell/functions.sh b/shell/functions.sh index 9c813d8..f15dccd 100644 --- a/shell/functions.sh +++ b/shell/functions.sh @@ -1,3 +1,20 @@ +function GET() { + curl -i -X GET -H "X-Requested-With: XMLHttpRequest" $* +} + +function POST() { + curl -i -X POST -H "X-Requested-With: XMLHttpRequest" $* + #-d "key=val" +} + +function PUT() { + curl -i -X PUT -H "X-Requested-With: XMLHttpRequest" $* +} + +function DELETE() { + curl -i -X DELETE -H "X-Requested-With: XMLHttpRequest" $* +} + function f() { find * -name $1; } function p() { cd $* && m diff --git a/shell/git.sh b/shell/git.sh index e8ead1e..29bbd8c 100644 --- a/shell/git.sh +++ b/shell/git.sh @@ -1,5 +1,7 @@ +[ `which hub` ] && alias git='hub' + alias gi='git init' -alias gst='git status' +alias gst='git status -s' alias gl='git pull --rebase' alias gp='git push' alias gpa='git push-all' # see [alias] in ~/.gitconfig @@ -15,6 +17,7 @@ alias gk='gitk --all &' alias gx="open -b nl.frim.GitX" alias grm="git stat | grep deleted | awk '{print $3}' | xargs git rm" alias gpatch='git diff master -p' +alias glg="git log --decorate --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative" alias ignore_empty='find . \( -type d -empty \) -and \( -not -regex ./\.git.* \) -exec touch {}/.gitignore \;' function gd() { diff --git a/shell/osx.sh b/shell/osx.sh index f679c87..a1ed6b2 100644 --- a/shell/osx.sh +++ b/shell/osx.sh @@ -1,6 +1,9 @@ export EDITOR='mate -wl1' +export VISUAL=$EDITOR +export GIT_EDITOR=$EDITOR + export PATH="/Library/PostgreSQL8/bin/:$PATH" -CDPATH="${CDPATH}:${HOME}/Code/Mocra/:${HOME}/Code/Personal:${HOME}/Sites/Mocra/:${HOME}/Sites/Personal/" +CDPATH="${CDPATH}:${HOME}/Code/Mocra/:${HOME}/Code/Personal:${HOME}/Sites/Mocra:${HOME}/Sites/Personal:${HOME}/Sites/Client/" alias o='open .' diff --git a/shell/prompt.sh b/shell/prompt.sh index 802c5e5..f493f06 100644 --- a/shell/prompt.sh +++ b/shell/prompt.sh @@ -46,7 +46,7 @@ function color { if [ $CURRENT_SHELL = 'zsh' ]; then echo "%{$chosen%}" else - printf "$chosen" + printf $chosenĀ® fi } diff --git a/zsh/config.zsh b/zsh/config.zsh index 6fc2468..26b882d 100644 --- a/zsh/config.zsh +++ b/zsh/config.zsh @@ -4,13 +4,29 @@ alias reload="source ~/.zshrc" bindkey "\e\e[C" vi-forward-word bindkey "\e\e[D" vi-backward-word +# # forward/back directories with Option+Up/Down +# function back-dir { +# cd -1 >/dev/null +# echo +# } +# +# function fwd-dir { +# cd +1 >/dev/null +# echo +# } +# +# zle -N back-dir back-dir +# zle -N fwd-dir fwd-dir +# +# bindkey "\e\e[A" back-dir +# bindkey "\e\e[B" fwd-dir + # http://www.scannedinavian.com/~shae/shae.zshrc # These are options I've copied but yet to totally investigate if it's what I want setopt alwaystoend # when complete from middle, move cursor setopt completeinword # not just at the end setopt correct # spelling correction setopt histverify # when using ! cmds, confirm first -setopt interactivecomments # escape commands so i can use them later setopt listpacked # compact completion lists setopt noautomenu # don't cycle completions setopt pushdignoredups # and don't duplicate them @@ -32,8 +48,10 @@ setopt extendedglob # awesome pattern matching (ala Dir.glob() in Rub setopt promptcr # ensure a new line before prompt is drawn setopt listtypes # show types in completion setopt nocompletealiases # Allows alias 'ga' to use 'git add' completions (for example) +setopt interactivecomments # escape commands so i can use them later + # jump to each element in a path with m-f m-b, same # for kill-word, etc. -export WORDCHARS='' +WORDCHARS=''