-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bashrc
301 lines (243 loc) · 8.59 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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
# ~/.bashrc: executed by bash(1) for non-login shells.
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
## When in screen session, use window specific history
if test $WINDOW
then
HISTFILE=~/.bash_history.${WINDOW}
fi
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=100000
HISTFILESIZE=200000
# Assure we write to history file immediately
export PROMPT_COMMAND="history -a; history -c; history -r; ${PROMPT_COMMAND}"
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
export AWS_TIMEOUT_SECONDS=3600
export LESS='-erX'
export EDITOR=vim
# You may uncomment the following lines if you want `ls' to be colorized:
export LS_OPTIONS='--color=auto'
export HISTCONTROL=ignoredups
eval `dircolors`
alias l='ls $LS_OPTIONS -lhtra'
alias ls='ls $LS_OPTIONS'
alias lsa='ls $LS_OPTIONS -Fahl'
alias cd.='cd ..'
alias cd..='cd ../..'
alias cd...='cd ../../..'
alias cd....='cd ../../../..'
alias cd.....='cd ../../../../..'
alias cd......='cd ../../../../../..'
alias cd.......='cd ../../../../../../..'
# Some more alias to avoid making mistakes:
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias tf='terraform'
alias tfi='terraform init'
alias tfp='terraform plan'
alias tfa='terraform apply'
alias stfp='summon -p /usr/bin/gopass terraform plan'
alias stfa='summon -p /usr/bin/gopass terraform apply'
# Add new git log format
alias gitlog="git log --graph --all --pretty='format:%C(auto)%h %C(cyan)%ar %C(auto)%d %C(magenta)%an %C(auto)%s'"
bind 'TAB: complete'
# set variable identifying the chroot you work in (used in the prompt below), ubuntu only
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
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'
fi
if [ -f ~/.dockerenv ]; then
source ~/.dockerenv
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# ~/.bashrc: executed by bash(1) for non-login shells.
if [ -f $HOME/.ssh/saveagent ]; then
echo "Saving agent"
. $HOME/.ssh/saveagent
fi
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
parse_git_branch()
{
local BRANCH=$(git symbolic-ref HEAD --short 2> /dev/null)
if [[ ! -z "$BRANCH" ]]
then
echo "($BRANCH)"
fi
}
BLACK='\[\e[0;30m\]' # Black - Regular
RED='\[\e[0;31m\]' # Red
GREEN='\[\e[0;32m\]' # Green
YELLOW='\[\e[0;33m\]' # Yellow
BLUE='\[\e[0;34m\]' # Blue
PURPLE='\[\e[0;35m\]' # Purple
CYAN='\[\e[0;36m\]' # Cyan
WHITE='\[\e[0;37m\]' # White
BLACK_BOLD='\[\e[1;30m\]' # Black - Bold
RED_BOLD='\[\e[1;31m\]' # Red - Bold
GREEN_BOLD='\[\e[1;32m\]' # Green - Bold
YELLOW_BOLD='\[\e[1;33m\]' # Yellow - Bold
BLUE_BOLD='\[\e[1;34m\]' # Blue - Bold
PURPLE_BOLD='\[\e[1;35m\]' # Purple - Bold
CYAN_BOLD='\[\e[1;36m\]' # Cyan - Bold
WHITE_BOLD='\[\e[1;37m\]' # White - Bold
RESET='\[\e[0m\]' # Text Reset
export PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] ${YELLOW}\$(parse_git_branch) ${WHITE}$ "
# grep aliases
alias grepsvn='grep -rIl --exclude-dir=.svn'
alias gitsvn='git svn'
if [ `id -u` -eq 0 ]; then
# export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/X11:/usr/games:~/local/lib/python:~/local/lib/python/lfm"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/bin/X11:/usr/games:~/local/lib/python/lfm"
fi
# export PYTHONPATH="/home/ltjeg/local/lib/python/"
# python on Git Bash Systems (on BURAUT machine)
if [[ $HOSTNAME == "CP001969" ]]; then
alias python="/c/Program\ Files\ \(x86\)/Microsoft\ Visual\ Studio/Shared/Python37_64/python.exe"
fi
PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/:"$PATH"
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/priv/ncurses-6.0/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/local/lib
export NODE_OPTIONS="--dns-result-order=ipv4first"
PATH=~/priv/ncurses-6.0/lib:"$PATH"
# set PATH so it includes user's private bin if it exists
if [ -d ~/local/bin ] ; then
PATH=~/local/bin:"$PATH"
fi
if [ -d ~/.local/bin ] ; then
PATH=~/.local/bin:"$PATH"
fi
if [ -d ~/local/lib ] ; then
PATH=~/local/lib:"$PATH"
fi
if [ -d ~/bin ] ; then
PATH=~/bin:"${PATH}"
fi
if [ -d ~/node ] ; then
PATH=~/node/out/Release:"${PATH}"
fi
if [ -d ~/npm ] ; then
PATH=~/node/out/bin:"${PATH}"
fi
if [ -d ~/jslint ] ; then
PATH=~/node/out/bin:"${PATH}"
fi
if [ -d ~/local/lib/python ] ; then
PATH=~/local/lib/python:"$PATH"
fi
if [ -d ~/local/lib/python/lfm ] ; then
PATH=~/local/lib/python/lfm:"$PATH"
fi
if [ -d ~/.gem/ruby/1.8/bin ] ; then
PATH=~/.gem/ruby/1.8/bin:"$PATH"
fi
if [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
alias homegit='git --git-dir=$HOME/.homegit --work-tree=$HOME'
alias apache2ctl='/usr/sbin/apache2ctl'
alias apa='sudo apache2ctl graceful'
alias chb='make user; apa'
alias nose='.venv/bin/nosetests -I test_links.py -I test_wmtscapabilities_auth.py -I test_wmtsgettile.py -I test_varnish.py -I test_file_storage.py'
alias gab='make user'
alias vimenc='vim -c '\''let $enc = &fileencoding | execute "!echo Encoding: $enc" | q'\'''
alias wintersmith='~/node_modules/wintersmith/bin/wintersmith'
alias cddev='cd ~/code/infra-terraform-swipos-dev'
alias cdprod='cd ~/code/infra-terraform-swipos'
alias cdpackdev='cd ~/code/infra-packer-swipos-dev'
alias cdpackprod='cd ~/code/infra-packer-swipos'
#alias npm="node --dns-result-order=ipv4first $(which npm)"
alias npm="npm"
alias node="node"
# Predictable SSH authentication socket location
MY_SOCK="/tmp/ssh-agent-$USER-screen"
if test $SSH_AUTH_SOCK && [ $SSH_AUTH_SOCK != $MY_SOCK ]
then
rm -f /tmp/ssh-agent-$USER-screen
ln -sf $SSH_AUTH_SOCK $MY_SOCK
export SSH_AUTH_SOCK=$MY_SOCK
fi
# Adding gopass completions
_gopass_bash_autocomplete() {
local cur opts base
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
local IFS=$'\n'
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
}
complete -F _gopass_bash_autocomplete gopass
set -o vi
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion