-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc
72 lines (59 loc) · 1.63 KB
/
bashrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# ~/.bash_profile: executed by bash(1) for login shells.
alias ls='ls --color'
alias ll='ls -l --color'
alias wg='wget -U AGENT'
alias free='free -m'
alias home='cd $HOME_DIR'
alias v='vim'
alias vi='vim'
source ~/.git-completion.bash
alias gs="git status"
alias ga="git add"
alias gd="git diff"
alias gc="git commit"
alias gp="git push"
alias gu="git gui"
export PYTHONPATH=~/lib/python/
export EDITOR=/usr/bin/vim
MAILCHECK=-1
HISTCONTROL=ignoreboth
HISTSIZE=100
bind "\C-e":clear-screen # bind ^e to clear
alias cds="cd;clear"
# Extends use of 'cd'
# cd ... # cd ../..
# cd .... # cd ../../..
# cd ...../foo # cd ../../../../foo
function cd () {
local -ri n=${#*};
if [ $n -eq 0 -o -d "${!n}" -o "${!n}" == "-" ]; then
builtin cd "$@";
else
local e="s:\.\.\.:../..:g";
builtin cd "${@:1:$n-1}" $(sed -e$e -e$e -e$e <<< "${!n}");
fi
}
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) rar x $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;
*.tgz) tar xzf $1 ;;
*.zip) unzip $1 ;;
*.Z) uncompress $1 ;;
*) echo "'$1' cannot be extracted via extract()" ;;
esac
else
echo "'$1' is not a valid file"
fi
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/:\1/'
}
PS1='\[\033[01;32m\]\u@\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]$(parse_git_branch)\$ '
#source ~/.bashrc.local