-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path.bashrc
115 lines (94 loc) · 3.36 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
# ~/.bashrc
GOROOT=/usr/local/go
GOPATH=$HOME/go
PATH=$HOME/.local/bin:$HOME/.dotfiles/bin:$PATH:$GOROOT/bin:$GOPATH/bin
export LANG=en_US.UTF-8
# History
HISTSIZE=50000
HISTFILESIZE=50000
HISTCONTROL=ignoredups:ignorespace
shopt -s histappend
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
Color_Off='\e[0m' # Text Reset
Black='\e[0;30m' # Black
White='\e[0;37m' # White
On_Black='\e[40m' # Black
On_White='\e[47m' # White
# prevent Ctrl-S from being a little bitch
[[ $- == *i* ]] && stty -ixon
alias sl=ls
alias ls='ls --color --group-directories-first -FAv'
alias ll='ls --color --group-directories-first -FAvlhG'
alias grep='grep --color=auto'
alias fix='stty sane'
alias code-server='code-server --allow-http --no-auth'
alias update='sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get install update-manager-core && sudo apt-get -f install && sudo apt-get autoremove && sudo apt-get autoclean'
# TMUX
alias tmux='TERM=screen-256color-bce tmux -2 -u'
alias ta='tmux attach -d -t'
alias fzf='fzf-tmux'
# Powerline
powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1
. ~/.local/lib/python3.5/site-packages/powerline/bindings/bash/powerline.sh
source ~/.dotfiles/tmuxinator.bash
if [[ -z "$TMUX" && $- == *i* ]] ;then
ID="`tmux ls | grep -vm1 attached | cut -d: -f1`" # get the id of a deattached session
if [[ -z "$ID" ]] ;then # if not available create a new one
tmux new-session
else
tmux attach-session -d -t "$ID" # if available attach to it
fi
fi
# Prompt
PS1="\[$Black$On_White\]\W \$\[$Color_Off\] "
PS1="$PS1"'$([ -n "$TMUX" ] && tmux setenv TMUXPWD_$(tmux display -p "#I_#P") "$PWD")'
export VISUAL=vim
export EDITOR="$VISUAL"
# enable bash completion in interactive shells
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
# Source plugins
source ~/.dotfiles/cdhist.sh
# Source local
source ~/.bashrc_local
# Ruby
if [[ -d ${HOME}/.rvm ]]; then
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
source ${HOME}/.rvm/scripts/rvm
fi
# Python
export PYTHONPATH=$PYTHONPATH:$HOME
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
eval "$(pyenv virtualenv-init -)"
export FZF_DEFAULT_COMMAND='
(git ls-files $(git rev-parse --show-toplevel) --cached --exclude-standard --others ||
find * -name ".*" -prune -o -type f -print -o -type l -print) 2> /dev/null'
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
strip_diff_leading_symbols(){
color_code_regex="(\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K])"
# simplify the unified patch diff header
sed -r "s/^($color_code_regex)diff --git .*$//g" | \
sed -r "s/^($color_code_regex)index .*$/\n\1$(rule)/g" | \
sed -r "s/^($color_code_regex)\+\+\+(.*)$/\1+++\5\n\1$(rule)\x1B\[m/g" |\
# actually strips the leading symbols
sed -r "s/^($color_code_regex)[\+\-]/\1 /g"
}
export -f strip_diff_leading_symbols
## Print a horizontal rule
rule () {
printf '%*s\n' "${COLUMNS:-$(tput cols)}" '' | tr ' ' -
}
alias gam="/home/ansto/bin/gamadv-xtd/gam"