-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
175 lines (143 loc) · 5.41 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
# Bashrc: only bash settings
# - Colors
# - History
# - Misc
# - Imports
# If not running interactively, don't do anything, to stop bind errors
[ -z "$PS1" ] && return
# Prefer US English and use UTF-8
export LANG="en_US.UTF-8"
export LANGUAGE="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
# Colors -----------------------------------------------------------------------
export TERM=xterm-color
# export GREP_OPTIONS='--color=auto' GREP_COLOR='1;32'
export CLICOLOR=1
# Setup some colors to use later in interactive shell or scripts
export COLOR_NC='\033[0m' # No Color
export NC=$COLOR_NC
export COLOR_WHITE='\033[1;37m'
export COLOR_BLACK='\033[0;30m'
export COLOR_BLUE='\033[0;34m'
export COLOR_LIGHT_BLUE='\033[1;34m'
export COLOR_GREEN='\033[0;32m'
export COLOR_LIGHT_GREEN='\033[1;32m'
export COLOR_CYAN='\033[0;36m'
export COLOR_LIGHT_CYAN='\033[1;36m'
export COLOR_RED='\033[0;31m'
export COLOR_LIGHT_RED='\033[1;31m'
export COLOR_PURPLE='\033[0;35m'
export COLOR_LIGHT_PURPLE='\033[1;35m'
export COLOR_BROWN='\033[0;33m'
export COLOR_YELLOW='\033[1;33m'
export COLOR_GRAY='\033[1;30m'
export COLOR_LIGHT_GRAY='\033[0;37m'
alias colorslist="set | egrep 'COLOR_\w*'" # lists all the colors
if [ `uname` = FreeBSD ]; then
export LS_OPTIONS='-G'
else
# Probably have GNU utils installed
#export LS_OPTIONS="--color=always"
export LS_OPTIONS=""
fi
# History -----------------------------------------------------------------------
# 1. Whenever displaying the prompt, reload history and write the previous line to disk, and update the term title
# 2. Don't overwrite existing prompt commands
MY_PROMPT='history -a; history -n; echo -ne "\033]0; ${PWD/$HOME/~}\007"'
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ;} ${MY_PROMPT}"
# Ignore common things
export HISTIGNORE="ls:ll:l:cd:p:[bf]g:exit:.:..:...:....:.....:cd -:pwd:exit:date:* --help"
# Ignore duplicates and lines beginnging a space in the history file
export HISTCONTROL=ignoreboth
# Larger bash history (allow 32³ entries; default is 500)
export HISTSIZE=32768
# Store a timestamp of when the cmd was run, for graphing/timing purposes
export HISTTIMEFORMAT='%Y-%m-%d %H:%M:%S - '
# Concatenate multi-line commands
shopt -s cmdhist
# Append to the history, rather than overwriting it
shopt -s histappend histreedit histverify
# Misc -------------------------------------------------------------------------
# auto-completion shows stats similiar to ls -F
shopt -s cdspell
# check the window size after each command and, if necessary, update the values of LINES and COLUMNS.
shopt -s checkwinsize
#glob in case insensitive manner
shopt -s nocaseglob
# Necessary for programmable completion.
shopt -s extglob
shopt -s sourcepath
shopt -s no_empty_cmd_completion
shopt -s cdable_vars
shopt -s checkhash
# include dotfiles in globs
# (to make `mv *` include them)
shopt -s dotglob
# bash completion settings (actually, these are readline settings)
bind "set completion-ignore-case on" # note: bind used instead of sticking these in .inputrc
bind "set bell-style none" # no bell
bind "set show-all-if-ambiguous On" # show list automatically, without double tab
#fix color/control character issues with git, enable wrapping
#defaut : export LESS="-FXRS"
export LESS="-FXR"
# Don’t clear the screen after quitting a manual page
export MANPAGER="less -X"
export EDITOR="vim"
export PAGER=less
export TIMEFORMAT=$'\nreal %3R\tuser %3U\tsys %3S\tpcpu %P\n'
# Only auto-update every 7 days
export HOMEBREW_AUTO_UPDATE_SECS=604800
# Prompt -----------------------------------------------------------------------------------------------
#PS1='$(gbt $?)'
# __GIT_PROMPT_DIR=~/.bash-git-prompt/
# source ~/.bash-git-prompt/gitprompt.sh
# https://starship.rs/
eval "$(starship init bash)"
# Imports ----------------------------------------------------------------------------------------------
# Add fuzzy finder scripts
# https://github.com/junegunn/fzf
[ -f ~/.fzf.bash ] && source ~/.fzf.bash
# enable python virtualenv wrapper
# [ -f /usr/local/bin/virtualenvwrapper.sh ] && source /usr/local/bin/virtualenvwrapper.sh
# enable python autoenv
[ -f /usr/local/opt/autoenv/activate.sh ] && source /usr/local/opt/autoenv/activate.sh
# Local bash file for machine specific tweaks/passwords
# [ -f ~/.bash_local ] && source ~/.bash_local
# try enabling brew autojump
if [[ -n $(command -v brew) && -f $(brew --prefix)/etc/autojump.sh ]] ; then
source $(brew --prefix)/etc/autojump.sh
fi
# import any local bash scripts
for file in ~/.bash/*.sh; do
if [ -f "$file" ] ; then
source "$file"
fi
done
# try enable bash cbash_scriptsompletion
[ -f /etc/bash_completion ] && source /etc/bash_completion
# try enable from homebrew
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion
#if [[ -n $(command -v brew) ]] ; then
# for file in $(brew --prefix)/etc/bash_completion.d/* ; do
# if [ -f "$file" ] ; then
# echo ".......... $file"
# source "$file"
# fi
# done
#fi
# Add local tmuxinator bash completion
# [ -f ~/.tmuxinator.bash ] && source ~/.tmuxinator.bash
function command_not_found_handle {
printf "not found"
# check because c-n-f could've been removed in the meantime
if [ -x /usr/lib/command-not-found ]; then
/usr/lib/command-not-found -- "$1"
return $?
elif [ -x /usr/share/command-not-found/command-not-found ]; then
/usr/share/command-not-found/command-not-found -- "$1"
return $?
else
printf "%s: command not found\n" "$1" >&2
return 127
fi
}