forked from kwkroeger/Dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc
175 lines (141 loc) · 3.99 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
# If not running interactively, don't do anything
[ -z "$P#S1" ] && return
export PS1="\[\e[0;91m\]\u\[\e[0;36m\]@\[\e[0;91m\]\h\[\e[0m\] \[\e[0;36m\]\W\[\e[0m\] \[\e[1;91m\]:\[\e[0m\]"
#export PS1="\u@\h:\W\\$ "
#export PS1="\[$(tput sgr0)\]\[$(tput setaf 1)\]\u\[$(tput setaf 6)\]@\[$(tput setaf 1)\]\h \[$(tput setaf 6)\]\W\[$(tput setaf 1)\]\\$ \[$(tput sgr0)\]"
### ALIASES ###
alias c='clear'
alias g='git'
alias vi='vim'
#Make things look nice on OSX and Linux
platform=$(uname)
if [[ $platform == 'Linux' ]]; then
# Linux things
alias ls='ls --color=auto'
alias l='ls -lahF --color=always'
elif [[ $platform == 'Darwin' ]]; then
# OS X things
alias pb="pbpaste | pbcopy"
alias ls='ls -G'
alias o="open"
alias du1='du -h -d 1'
fi
#Make Things Look Nice
alias df='df -h'
alias du='du -ch'
alias diff="$HOME/.colordiff"
alias grep='grep --color=always'
alias mkdir='mkdir -pv'
# Enable aliases to be sudo’ed
alias sudo='sudo '
#Ease of Use
alias mdstat='cat /proc/mdstat'
alias ports='netstat -tulanp'
alias wget='wget -c'
#Simple Git
alias gadd="git add"
alias gs="git status"
alias gpull="git pull"
alias gpush="git push"
alias gnotrack="git update-index --assume-unchanged"
alias gtrack="git update-index --no-assume-unchanged"
#Sorry Steam Locomotive and GTI
alias sl='ls'
alias gti='git'
#Programs and Script's I can't live without
alias ack="$HOME/.pt"
alias htop="$HOME/.htop"
alias pt="$HOME/.pt"
alias smem="$HOME/.smem"
#Easier Back Navigation
alias .='cd ../'
alias ..='cd ../../'
alias ...='cd ../../../'
alias ....='cd ../../../../'
#Only use X11 Forwarding Explicitly
alias ssh='ssh -x'
alias ssy='ssh -CX -c arcfour,blowfish-cbc'
### GIT ###
gcom () {
git commit -am $1
}
gita () {
git add *; git commit -m $1; sleep 1; git push;
}
### COMPLETION ###
complete -cf sudo
set completion-ignore-case on
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
if [ -d /usr/local/etc/bash_completion.d ] && ! shopt -oq posix; then
for completion in /usr/local/etc/bash_completion.d/*;do
. /usr/local/etc/bash_completion.d/completion
done
fi
### FUNCTIONS ###
# extract a file
function extract {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Usage: extract <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
else
if [ -f $1 ] ; then
# NAME=${1%.*}
# mkdir $NAME && cd $NAME
case $1 in
*.tar.bz2) tar xvjf ../$1 ;;
*.tar.gz) tar xvzf ../$1 ;;
*.tar.xz) tar xvJf ../$1 ;;
*.lzma) unlzma ../$1 ;;
*.bz2) bunzip2 ../$1 ;;
*.rar) unrar x -ad ../$1 ;;
*.gz) gunzip ../$1 ;;
*.tar) tar xvf ../$1 ;;
*.tbz2) tar xvjf ../$1 ;;
*.tgz) tar xvzf ../$1 ;;
*.zip) unzip ../$1 ;;
*.Z) uncompress ../$1 ;;
*.7z) 7z x ../$1 ;;
*.xz) unxz ../$1 ;;
*.exe) cabextract ../$1 ;;
*) echo "extract: '$1' - unknown archive method" ;;
esac
else
echo "$1 - file does not exist"
fi
fi
}
alias x="extract"
### VARIABLES ###
export BLOCKSIZE=M
## EDITOR ##
export EDITOR='vim'
export SVN_EDITOR='vim'
export VISUAL='vim'
## LESS ##
export LESSOPEN='|$HOME/.lesspipe/lesspipe.sh %s'
export LESS='-R'
## HISTORY ##
export HISTCONTROL='ignoredups:ignoreboth'
export HISTSIZE=16384
export HISTFILESIZE=$HISTSIZE
export HISTTIMEFORMAT="%a %F %r "
export HISTIGNORE='&:[ ]*:clear:exit'
export PROMPT_COMMAND='history -a; history -r'
shopt -s cmdhist
shopt -s histappend
## MAIL ##
shopt -u mailwarn
unset MAILCHECK
## TERMINAL ##
export TERM=xterm-256color
force_color_prompt=yes
shopt -s cdspell
shopt -s checkwinsize
shopt -s nocaseglob
## Brew Management
alias update='brew update; brew upgrade; brew cleanup'
## Ignore case when using tab complete
bind "set completion-ignore-case on"
cd $HOME