-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
165 lines (113 loc) · 4.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
#
# ~/.bashrc
#
# If not running interactively, don't do anything
[[ $- != *i* ]] && return
############################################## ENV ########################################
export LANG=en_US.UTF-8
export USER=$(/usr/bin/whoami)
export PATH=/bin:/sbin
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/bin/core_perl:$PATH
#export PATH=$HOME/.gem/ruby/2.1.0/bin:$PATH
export PATH=/usr/games/bin:$PATH
#export SHELL=/usr/bin/bash ## ARCH
#export SHELL=/bin/bash ## GENTOO
export EDITOR=vim
############################################### SHELL #####################################
alias ls='ls --color=auto'
alias df='df -Th'
alias du='du -h'
alias update-deb="sudo apt-get update;sudo apt-get upgrade -y;sudo apt-get dist-upgrade -y; sudo apt-get autoremove -y;sudo apt-get clean -y"
PS1='[\u@\h \W]\$ '
############################################### HISTORY ###################################
export HISTFILE=~/.bash_histfile
HISTSIZE=65536
shopt -s histappend
PROMPT_COMMAND='history -a'
################################################ BINDKEYS ################################
bind '"\eOD"':backward-word
bind '"\eOd"':backward-word
bind '"\eOC"':forward-word
bind '"\eOc"':forward-word
set -o emacs # Set emacs mode in bash (see below)
# PYTHON ######################################################################
export PYTHONPATH=~/.local/lib64/python2.7/site-packages
# POWERLINE ###################################################################
# installed ? (if not) then install
# git clone
if [ ! -d ~/.powerline ]
then
git clone https://github.com/powerline/powerline.git .powerline
fi
if [ ! -d ~/.local/lib64/python2.7/site-packages ]
then
mkdir -p ~/.local/lib64/python2.7/site-packages
# link .powerline/powerline to .local/lib64/python2.7/sites-packages/powerline
ln -s ~/.powerline/powerline ~/.local/lib64/python2.7/site-packages/powerline
fi
PATH=~/.powerline/scripts:$PATH
# export powerline bin and bind zsh
. ~/.local/lib64/python2.7/site-packages/powerline/bindings/bash/powerline.sh
# utilize powerline-daemon for quicker responses from powerline
powerline-daemon -q
############################################# FUZZY FINDER ################################
#source ~/.fzf.bash
#fh() {
# eval $(history | fzf +s | sed 's/ *[0-9]* *//')
#}
#fp() {
# ps -ef | sed 1d | fzf -m | awk '{print $2}' | xargs kill -${1:-9};
#}
#fd() {
# DIR=$(find ${1:-*} ${1:-.??*} | fzf) && cd "$DIR";
#}
#bind '"\C-F":"fh\n"' # fzf history
#bind '"\C-T":"fp\n"' # fzf process
#bind '"\C-E":"fd\n"' # fzf directory
###################################### GEN (UNTRACKED/CUSTOM) DOT FILES ##############################
#if [[ ! -c $HOME/.tmux.conf ]]
#then
# touch $HOME/.tmux.conf
# echo "source '$HOME/.powerline/powerline/bindings/tmux/powerline.conf'" >> $HOME/.tmux.conf
# echo "set -g default-terminal \"screen-256color\"" >> $HOME/.tmux.conf
#fi
##################################### GIT SETTINGS ###################################################
#
# git config --global user.email "name@host"
# git config --global user.name "name"
# git config --global core.editor "vim"
# git config --global push.default "simple"
# git config --global color.branch auto
# git config --global color.diff auto
# git config --global color.interactive auto
# git config --global color.status auto
# https://robinwinslow.uk/2012/07/20/tmux-and-ssh-auto-login-with-ssh-agent-finally/ (MODIFIED...)
# TMUX ON SSH CONNECTIONS
# get parent process ... if not sshd, then don't bother with joining tmux session...
ppid="$(ps -p $$ -o ppid=)"
ppid="${ppid// /}"
pcom=$(ps -p $ppid -o command=)
#echo "pcom = $pcom"
if [ -z "$TMUX" ] && [[ $pcom == sshd* ]]; then
# we're not in a tmux session
if [ ! -z "$SSH_TTY" ]; then
# We logged in via SSH
# if ssh auth variable is missing
if [ -z "$SSH_AUTH_SOCK" ]; then
export SSH_AUTH_SOCK="$HOME/.ssh/.auth_socket"
fi
# if socket is available create the new auth session
if [ ! -S "$SSH_AUTH_SOCK" ]; then
`ssh-agent -a $SSH_AUTH_SOCK` > /dev/null >&1
echo $SSH_AGENT_PID > $HOME/.ssh/.auth_pid
fi
# if agent isn't defined, recreate it from pid file
if [ -z $SSH_AGENT_PID ]; then
export SSH_AGENT_PID=`cat $HOME/.ssh/.auth_pid 2>/dev/null`
fi
# Add all default keys to ssh auth
ssh-add 2>/dev/null
# start tmux
tmux attach 2>/dev/null
fi
fi