Created
November 14, 2013 11:03
-
-
Save Altreus/7465009 to your computer and use it in GitHub Desktop.
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
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
PS1='${debian_chroot:+($debian_chroot)}\[\033[02;33m\]\u@\h\[\033[01;31m\]:\w \$\[\033[00m\] ' | |
# User specific aliases and functions | |
alias ll='ls -alh' | |
alias cd..='cd ..' | |
alias hgr='cd $(hg root)' | |
alias hgrst='hg st $(hg root)' | |
alias ack='ack --pager="less -R"' | |
#alias vim='vim +NERDTree' | |
alias gitr='cd $(git rev-parse --show-toplevel)' | |
alias please='sudo $(fc -nl -1)' | |
export EDITOR=vim | |
export A=/mnt/pdrive/Colleague\ Area | |
export C=/mnt/pdrive/Clients | |
export D=/mnt/pdrive/Developer | |
cdup() { | |
p=${1} | |
if [[ $p = -* ]]; then | |
c="cd " | |
while [[ $p -lt 0 ]]; do | |
c=$c"../" | |
let p=p+1 | |
done | |
$c | |
else | |
a=$(pwd) | |
#remove current dir | |
b=${a%/*} | |
#build cd | |
c="cd "${b%$1*}$1 | |
$c | |
fi | |
} | |
_cdup_complete() { | |
local cur prev path ar opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
path=$(pwd) | |
old_ifs=$IFS | |
IFS=/ | |
ar=$path | |
opts="" | |
for x in $ar; do | |
opts=$opts$x" " | |
done | |
IFS=$old_ifs | |
COMPREPLY=( $(compgen -W "${opts}" ${cur}) ) | |
} | |
cv() { | |
target=${1} | |
# get current version from PWD | |
p=${PWD#*/versions/} | |
p=${p%%/*} | |
cd ${PWD/$p/$target} | |
} | |
cc() { | |
target=${1} | |
p=${PWD#*/Clients/} | |
p=${p%%/*} | |
cd ${PWD/$p/$target} 2>/dev/null || cd /mnt/pdrive/Clients/$target; | |
} | |
_cc_complete() { | |
local cur prev | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
COMPREPLY=($(ls -d "/mnt/pdrive/Clients/${cur}"*)); | |
} | |
c() { | |
d=${1#d} | |
cd "$d" | |
} | |
wherewasi() { | |
cd $(cat $HOME/.lastcwd) | |
} | |
complete -F _cdup_complete cdup | |
export PERL5LIB=$HOME/perl5/lib/perl5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment