-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
executable file
·235 lines (194 loc) · 7.08 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
#---------------------------------------------------------------
# General Configuration
#---------------------------------------------------------------
# You may need to manually set your language environment
export LANG=en_US.UTF-8
# some ls aliases
alias ll='ls -lt'
alias la='ls -A'
alias l='ls -CF'
alias cat='/usr/local/bin/ccat'
alias du='ncdu'
alias file="xdg-open"
# alias file=nemo
alias python=python3
alias pip=pip3
alias rm=trash
# set prompt %s λ or └─▪ or →
#PS1="[\d \t] \u@\h\n\w\$ "
#---------------------------------------------------------------
# History
#---------------------------------------------------------------
# Don’t save lines which begin with a <space> character
HISTCONTROL=ignorespace
# Eliminate duplicates
HISTCONTROL=erasedups
# append to the history file, don't overwrite it
shopt -s histappend
# Setting HIST to a value less than zero causes the history list to be unlimited
export HISTSIZE=-1
export HISTFILESIZE=-1
export HISTFILE=~/.bash_eternal_history
export HISTTIMEFORMAT="%h %d %H:%M:%S "
export HISTIGNORE="git*:history:ll*:ls:ps"
# Bash only records a session when terminate
# Force prompt to write history after every command.
PROMPT_COMMAND="history -a; $PROMPT_COMMAND"
#---------------------------------------------------------------
# Oh my bash
#---------------------------------------------------------------
# Path to your oh-my-bash installation.
export OSH=$HOME/.oh-my-bash
# Set name of the theme to load. Optionally, if you set this to "random"
# it'll load a random theme each time that oh-my-bash is loaded.
# OSH_THEME="powerline"
# OSH_THEME="powerline-multiline"
# OSH_THEME="powerline-naked"
# OSH_THEME="powerline-plain"
OSH_THEME="zork"
# OSH_THEME="90210"
# OSH_THEME="nwinkler"
# Uncomment the following line to use case-sensitive completion.
CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion. Case
# sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"
# Uncomment the following line to change how often to auto-update (in days).
export UPDATE_OSH_DAYS=1
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Would you like to use another custom folder than $OSH/custom?
# OSH_CUSTOM=/path/to/new-custom-folder
# Which completions would you like to load? (completions can be found in ~/.oh-my-bash/completions/*)
# Custom completions may be added to ~/.oh-my-bash/custom/completions/
# Example format: completions=(ssh git bundler gem pip pip3)
# Add wisely, as too many completions slow down shell startup.
completions=(
composer
ssh
git
)
# Which aliases would you like to load? (aliases can be found in ~/.oh-my-bash/aliases/*)
# Custom aliases may be added to ~/.oh-my-bash/custom/aliases/
# Example format: aliases=(vagrant composer git-avh)
# Add wisely, as too many aliases slow down shell startup.
aliases=(
general
)
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-bash/plugins/*)
# Custom plugins may be added to ~/.oh-my-bash/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
bashmarks
git
)
source $OSH/oh-my-bash.sh
#---------------------------------------------------------------
# Colored Terminal
#---------------------------------------------------------------
NORMAL=`echo -e '\033[0m'`
RED=`echo -e '\033[31m'`
GREEN=`echo -e '\033[0;32m'`
LGREEN=`echo -e '\033[1;32m'`
BLUE=`echo -e '\033[0;34m'`
LBLUE=`echo -e '\033[1;34m'`
YELLOW=`echo -e '\033[0;33m'`
# grep
GREP_OPTS='--color=auto' # for aliases since $GREP_OPTIONS is deprecated
GREP_COLOR='1;32' # (legacy) bright green rather than default red
GREP_COLORS="ms=$GREP_COLOR" # (new) Matching text in Selected line = green
alias grep='grep $GREP_OPTS'
alias egrep='egrep $GREP_OPTS'
alias fgrep='fgrep $GREP_OPTS'
# colored GCC warnings and errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
# man pg
function _colorman() {
env \
LESS_TERMCAP_mb=$(printf "\e[1;35m") \
LESS_TERMCAP_md=$(printf "\e[1;34m") \
LESS_TERMCAP_me=$(printf "\e[0m") \
LESS_TERMCAP_se=$(printf "\e[0m") \
LESS_TERMCAP_so=$(printf "\e[7;40m") \
LESS_TERMCAP_ue=$(printf "\e[0m") \
LESS_TERMCAP_us=$(printf "\e[1;33m") \
"$@"
}
function man() { _colorman man "$@"; }
function perldoc() { command perldoc -n less "$@" |man -l -; }
# GNU ls
# use the config at ~/.dircolors if it exists, otherwise generate anew
eval "$( dircolors --sh $(ls -d ~/.dircolors 2>/dev/null) )"
# Usage: _ls_colors_add BASE NEW [NEW...]
# Have LS color given NEW extensions the way BASE extension is colored
# LS_COLORS
# 1=bold ; 93=Yellow
# di = (DIR) Directory
# ex = (EXEC) Executable file (ie. has 'x' set in permissions)
# fi = (FILE) Normal file
# *.extension = Every file using this extension e.g. *.rpm = files with the ending .rpm
LS_COLORS=$LS_COLORS:'di=1;93:ex=1;33:*.gitignore=34:*LICENSE=34:*.editorconfig=34' ;
_ls_colors_add() {
local BASE_COLOR="${LS_COLORS##*:?.$1=}" NEW
if [ "$LS_COLORS" != "$BASE_COLOR" ]; then
BASE_COLOR="${LS_COLORS}"
shift
for NEW in "$@"; do
if [ "$LS_COLORS" = "${LS_COLORS#*.$NEW=}" ]; then
LS_COLORS="${LS_COLORS%%:}:*.$NEW=$BASE_COLOR:"
fi
done
fi
export LS_COLORS
}
_ls_colors_add zip jar xpi egg # archives
_ls_colors_add jpg ico JPG PNG webp # images
_ls_colors_add ogg opus # audio (opus now included by default)
CLICOLOR=1 # BSD auto-color trigger (like ls -G but for everything)
if ls -ld --color=auto / >/dev/null 2>&1
then alias ls="ls -ph --color=auto"
else alias ls="ls -ph"
fi
# Networks
IP4=$GREEN
IP6=$LBLUE
IFACE=${YELLOW}
DEFAULT_ROUTE=$LBLUE
IP_CMD=$(which ip)
function colored_ip()
{
${IP_CMD} $@ | sed \
-e "s/inet [^ ]\+ /${IP4}&${NORMAL}/g"\
-e "s/inet6 [^ ]\+ /${IP6}&${NORMAL}/g"\
-e "s/^default via .*$/${DEFAULT_ROUTE}&${NORMAL}/"\
-e "s/^\([0-9]\+: \+\)\([^ \t]\+\)/\1${IFACE}\2${NORMAL}/"
}
alias ip='colored_ip'
#---------------------------------------------------------------
# Paths
#---------------------------------------------------------------
export EDITOR=/usr/bin/vim
# Java
# export JAVA_HOME=/usr/lib/jvm/default-java
# Python
# export PYTHONHOME=
# export PYTHONPATH=
# AWS
# export AWS_ACCESS_KEY_ID=
# export AWS_SECRET_ACCESS_KEY=
# MAVEN artifactory
# export MAVEN_artifactoryPass_reader=
# export MAVEN_artifactoryUser_reader=reader