From 57a57660832b1d5a6bea49b04a947e2aa245fe6b Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Date: Fri, 1 Mar 2013 18:20:48 +0100 Subject: Putting the "g" function back to the bashrc file. I tried to do fancy stuff with the CDPATH and a directory with symlinks inside, but it didn't work the way I wanted. So the "g" function is back. I've also removed some shortcuts that are not needed. --- bashrc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'bashrc') diff --git a/bashrc b/bashrc index 2b2d43e..4cbab8e 100644 --- a/bashrc +++ b/bashrc @@ -50,5 +50,24 @@ export GOROOT=$HOME/Projects/go export GOPATH=$HOME/.go export PATH=$HOME/.go/bin:$HOME/Projects/go/bin:$PATH -# Exporting our own CDPATH -export CDPATH=$CDPATH:$HOME/.cd +# Including shortcuts, idea from https://github.com/fxn/dotfiles +GO_SHORTCUTS=( + ruby + $RUBY + + build + $KDEV/build/kdev-ruby +) + +function g { + local target=$1 + local len=${#GO_SHORTCUTS[@]} + for (( i=0; i<$len; i+=2 )); do + if [[ "$1" = "${GO_SHORTCUTS[$i]}" ]]; then + cd "${GO_SHORTCUTS[$i+1]}" + return + fi + done + echo "unknown shortcut" +} + -- cgit v1.2.3