-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
198 lines (172 loc) · 5.54 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Source bash_profile
if [ -f ~/.bash_profile ]; then
source ~/.bash_profile
fi
# User specific aliases and functions
# Git Aliases
alias gs='git status '
alias ga='git add '
alias gb='git branch '
alias gc='git commit'
alias gd='git diff'
alias go='git checkout '
alias gs='git status'
alias gstsh='git stash'
alias gst='git stash'
alias gshw='git show'
alias gshow='git show'
alias gi='vim .gitignore'
alias gcm='git ci -m'
alias gcim='git ci -m'
alias gci='git ci'
alias gco='git co'
alias gcp='git cp'
alias ga='git add -A'
alias guns='git unstage'
alias gunc='git uncommit'
alias gm='git merge'
alias gms='git merge --squash'
alias gam='git amend --reset-author'
alias grv='git remote -v'
alias grr='git remote rm'
alias grad='git remote add'
alias gr='git rebase'
alias gra='git rebase --abort'
alias ggrc='git rebase --continue'
alias gbi='git rebase --interactive'
alias gl='git pull'
alias glg='git l'
alias glog='git l'
alias co='git co'
alias gf='git fetch'
alias gfch='git fetch'
alias gd='git diff'
alias gb='git b'
alias gbd='git b -D -w'
alias gdc='git diff --cached -w'
alias gpub='grb publish'
alias gtr='grb track'
alias gpl='git pull'
alias gplr='git pull --rebase'
alias gps='git push'
alias gpsh='git push'
alias gnb='git nb' # new branch aka checkout -b
alias grs='git reset'
alias grsh='git reset --hard'
alias gcln='git clean'
alias gclndf='git clean -df'
alias gclndfx='git clean -dfx'
alias gsm='git submodule'
alias gsmi='git submodule init'
alias gsmu='git submodule update'
alias gt='git t'
alias gbg='git bisect good'
alias gbb='git bisect bad'
alias gbmv='git branch -m'
alias cat='ccat'
# Stash (s)
alias gsa='git stash apply'
alias gsx='git stash drop'
alias gsX='git-stash-clear-interactive'
alias gsl='git stash list'
alias gsL='git-stash-dropped'
alias gsd='git stash show --patch --stat'
alias gsp='git stash pop'
alias gsr='git-stash-recover'
alias gss='git stash save --include-untracked'
alias gsS='git stash save --patch --no-keep-index'
alias gsw='git stash save --include-untracked --keep-index'
shopt -s cdspell # Correct cd typos
shopt -s cdable_vars # set the bash option so that no '$' is required (disallow write access to terminal)
shopt -s checkhash
shopt -s checkwinsize # Update windows size on command
shopt -s histappend # Append History instead of overwriting file
shopt -s cmdhist # Bash attempts to save all lines of a multiple-line command in the same history entry
shopt -s extglob # Extended pattern
shopt -s no_empty_cmd_completion # No empty completion
#shopt -s histappend # append to the history file, don't overwrite it
shopt -s histappend histreedit histverify
shopt -s mailwarn # keep an eye on the mail file (access time)
shopt -s nocaseglob # pathname expansion will be treated as case-insensitive (auto-corrects the case)
shopt -s sourcepath
# COMPLETION {{{
[[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \
. /usr/share/bash-completion/bash_completion
#}}}
export EDITOR="vim"
# BASH HISTORY {{{
# make multiple shells share the same history file
export HISTSIZE=1000 # bash history will save N commands
export HISTFILESIZE=${HISTSIZE} # bash will remember N commands
export HISTCONTROL=ignoreboth:erasedups # ingore duplicates and spaces
export HISTIGNORE='&:ls:ll:la:cd:exit:clear:history:bg:fg'
export HISTTIMEFORMAT='%Y-%m-%d_%H:%M:%S_%a ' # makes history display in YYYY-MM-DD_HH:MM:SS_3CharWeekdaySpaceSpace format
#}}}
export BLOCKSIZE=K
export VISUAL='vi'
set -b
set -o notify
set visible-stats on
# AUTOCOLOR {{{
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
#}}}
# MODIFIED COMMANDS {{{
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../..'
alias .....='cd ../../../..'
alias ......='cd ../../../../..'
alias ~='cd ~'
alias df='df -h'
alias diff='colordiff' # requires colordiff package
alias du='du -c -h'
alias free='free -m' # show sizes in MB
alias grep='grep --color=auto'
alias grep='grep --color=tty -d skip'
alias mkdir='mkdir -p -v'
alias more='less'
alias nano='nano -w'
alias ping='ping -c 5'
#}}}
# LS {{{
alias ls='ls -hF --color=auto'
alias lr='ls -R' # recursive ls
alias ll='ls -alh'
alias la='ll -A'
alias lm='la | less'
#}}}
alias tmux="tmux new-session -A -s main"
# TOP 10 COMMANDS {{{
top10() { history | awk '{a[$2]++ } END{for(i in a){print a[i] " " i}}' | sort -rn | head; }
#}}}
PS1="\n\[\e[32;1m\](\`if [ \$? = 0 ]; then echo \[\e[33m\]^_^\[\e[0m\]; else echo \[\e[31m\]X_X\[\e[0m\]; fi\`\[\e[32;1m\]) - \[\e[32;1m\](\[\e[37;1m\]\u@\h\[\e[32;1m\]) - (\[\e[37;1m\]jobs:\j\[\e[32;1m\]) - (\[\e[37;1m\]\w\[\e[32;1m\]) - (\[\e[37;0m\]\!\[\e[32;1m\]) \n----> \[\e[0m\]"
LS_COLORS="$LS_COLORS:di=00;33"
setxkbmap -option ctrl:swapcaps
source /usr/share/autojump/autojump.sh
# Create scratch dir
function new-scratch {
cur_dir="$HOME/scratch"
new_dir="$HOME/tmp/scratch-`date +'%s'`"
mkdir -p $new_dir
ln -nfs $new_dir $cur_dir
cd $cur_dir
echo "New scratch dir ready for grinding ;>"
}
export TERM=xterm-256color
# Tmux - attach to an existing session or create a new one
if command -v tmux>/dev/null; then
if [ ! -z "$PS1" ]; then # unless shell not loaded interactively, run tmux
[[ ! $TERM =~ screen ]] && [ -z $TMUX ] && exec tmux new-session -A -s main
fi
fi
eval "$(fasd --init auto)"