-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbashrc
213 lines (179 loc) · 6.17 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
# PS4='+[${SECONDS}s][${BASH_SOURCE}:${LINENO}]: ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
# set -x
# If not running interactively, don't do anything (debian way)
[ -z "$PS1" ] && return
# If not running interactively, don't do anything (arch way)
[[ $- != *i* ]] && return
# load system-wide conf
test -r /etc/profile && . /etc/profile
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=10000
HISTFILESIZE=20000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
##########################
# Set vi mode
set -o vi
# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# Fixes for mac os
if [ "$(uname)" == "Darwin" ]; then
# enable colors on terminal
export CLICOLOR=1
# fix python LANG
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
fi
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# My custom scripts
if [ -f ~/.bash_functions ]; then
. ~/.bash_functions
fi
# load bash completion on arch linux
if [ -f /etc/arch-release ]; then
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
fi
if [ "$(uname)" == "Darwin" ]; then
if [ -f `brew --prefix`/etc/bash_completion ]; then
. `brew --prefix`/etc/bash_completion
fi
fi
########################
# Enable nvm
if [[ "$(uname -r)" != *-microsoft* ]]; then # Avoid loading nvm on wsl (improve performance)
if [[ -s /usr/share/nvm/init-nvm.sh ]]; then
source /usr/share/nvm/init-nvm.sh
# Homebrew way
elif [ "$(uname)" == "Darwin" ]; then
if [ -f `brew --prefix nvm`/nvm.sh ]; then
export NVM_DIR=~/.nvm
. $(brew --prefix nvm)/nvm.sh
fi
else
[[ -s "$HOME/.nvm/nvm.sh" ]] && . "$HOME/.nvm/nvm.sh" # This loads NVM
[[ -r $NVM_DIR/bash_completion ]] && . $NVM_DIR/bash_completion
fi
fi
#########################
# fzf bindings
if [[ -f /usr/share/fzf/key-bindings.bash ]]; then
. /usr/share/fzf/key-bindings.bash
fi
if [[ -f /usr/share/fzf/completion.bash ]]; then
. /usr/share/fzf/completion.bash
fi
if [[ -f ~/.fzf.bash ]]; then
. ~/.fzf.bash
fi
#########################
# Enable rbenv shims and autocompletion
if [[ "$(uname -r)" != *-microsoft* ]]; then # Avoid loading rbenv on wsl (improve performance)
export PATH=$HOME/.rbenv/bin:$PATH # Using rbenv
eval "$(rbenv init - 2> /dev/null)"
fi
#########################
# Enable pyenv shims and autocompletion
if [[ "$(uname -r)" != *-microsoft* ]]; then # Avoid loading pyenv on wsl (improve performance)
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init - 2> /dev/null)"
fi
fi
#########################
# Enable jenv shims and autocompletion
if which jenv > /dev/null 2>&1; then eval "$(jenv init -)"; fi
# rbenv prompt (from https://gist.github.com/kyanny/1668822)
__rbenv_ps1 ()
{
[[ "$(uname -r)" == *-microsoft* ]] && return;
rbenv_ruby_version=`rbenv version 2> /dev/null | sed -e 's/ .*//'`
printf $rbenv_ruby_version
}
# nvm prompt
__nvm_ps1 ()
{
[[ "$(uname -r)" == *-microsoft* ]] && return;
echo `nvm_ls 'current'`
}
# pyenv prompt
__pyenv_ps1 ()
{
[[ "$(uname -r)" == *-microsoft* ]] && return;
echo `pyenv version | cut -d' ' -f 1`
}
if [ -f /usr/share/git/git-prompt.sh ]; then
. /usr/share/git/git-prompt.sh
fi
#########################
# Load sensitive env vars (like application-specific password for google
# account)
if [ -f ~/.env ]; then
. ~/.env
fi
#########################
# Defining & redefining some env vars
# export PULSE_LATENCY_MSEC=60 # Uncomment this line if skype sound is distorted
export MANPAGER="sh -c 'col -bx | bat -l man -p'"
export FZF_DEFAULT_COMMAND='ag -g ""'
# dark edge
export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'
--color=fg:#c5cdd9,bg:#262729,hl:#6cb6eb
--color=fg+:#c5cdd9,bg+:#262729,hl+:#5dbbc1
--color=info:#88909f,prompt:#ec7279,pointer:#d38aea
--color=marker:#a0c980,spinner:#ec7279,header:#5dbbc1'
# light edge
#export FZF_DEFAULT_OPTS=$FZF_DEFAULT_OPTS'
#--color=fg:#4b505b,bg:#fafafa,hl:#5079be
#--color=fg+:#4b505b,bg+:#fafafa,hl+:#3a8b84
#--color=info:#88909f,prompt:#d05858,pointer:#b05ccc
#--color=marker:#608e32,spinner:#d05858,header:#3a8b84'
export EDITOR='nvim'
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PYTHONPATH=$HOME/.local/python-libs:/usr/lib/python3.4/site-packages
#export M2_HOME=/opt/maven # Maven home
#export M2=$M2_HOME/bin # Maven bin
export IRBRC=$HOME/.irbrc # irb config
export DATOMIC_INSTALL_DIR=~/.local/datomic-free-0.9.5697
export CDPATH=$CDPATH:$WORKSPACE # workspace on cd
export PATH=$HOME/.gem/ruby/2.5.0/bin:$PATH # ruby gems
export PATH=$HOME/.local/bin:$PATH # local executables
export PATH=$HOME/Applications/sbt/bin:$PATH # Scala build tool
#export PATH=$M2:$PATH # Maven
export PATH="/usr/local/heroku/bin:$PATH" # Heroku Toolbelt
export PATH=$HOME/.local/share/nvim/plugged/vim-iced/bin:$PATH # iced-vim bin
export PATH=$HOME/Applications/android-sdk-linux/platform-tools:$PATH # Android
export PATH=$HOME/Applications/apache-jmeter/bin:$PATH # JMeter
if [ -d $HOME/.cargo/bin ]; then
export PATH=$PATH:$HOME/.cargo/bin
fi
#########################
# Prompt
if [ -f ~/.bash_prompt ]; then
. ~/.bash_prompt
fi
##########################
# load direnv
if command -v direnv 1>/dev/null 2>&1; then
eval "$(direnv hook bash)"
fi
##########################
# load m-cli (github.com/rgcr/m-cli)
if [ -f /usr/local/m-cli/m ]; then
export PATH=$PATH:/usr/local/m-cli
fi