-
Notifications
You must be signed in to change notification settings - Fork 1
/
.bashrc
161 lines (128 loc) · 4.11 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
# ~/.bashrc: executed by bash for non-login shells.
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
[[ $- == *i* ]] && source $HOME/.bash/ble.sh/out/ble.sh --noattach --rcfile $HOME/.bash/blerc
# ===============
# SETTINGS
# ===============
# set edit mode
set -o emacs
# fail if any command in pipe fails
set -o pipefail
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# enable extended pattern matching features
# see http://wiki.bash-hackers.org/syntax/pattern
shopt -s extglob
# a command name that is the name of a directory is executed
# as if it were the argument to the cd command.
shopt -s autocd
# perform word expansion when trying filename completion
# useful when trying to type path with variable on it
# shopt -s direxpand
# disable programable completion
shopt -u progcomp
# minor errors in the spelling of a directory component in a cd command
# will be corrected. The errors checked for are transposed characters,
# a missing character, and one character too many. If a correction is found,
# the corrected file name is printed, and the command proceeds.
shopt -s cdspell 2>/dev/null
# expands bang combinations and variables to their values
# SEE man bash / HISTORY EXPANSION for a full list of bang features
bind Space:magic-space
# disable Ctrl-S ( flow control )
stty -ixon
# turn off feature to send focus gain or focus lost commands ^[[O ^[[I
printf "\e[?1004l" # doesn't look like it works
# ===============
# HISTORY CONTROL
# ===============
# don't save duplicates
HISTCONTROL=ignoreboth:erasedups
# append to the history file, don't overwrite it
shopt -s histappend
# set history length
HISTSIZE=20000
HISTFILESIZE=40000
# remove duplicates from history file while preserving order
if [ -f $HISTFILE ] ; then
tac $HISTFILE | awk '!x[$0]++' > /tmp/history_file && tac /tmp/history_file > $HISTFILE
rm /tmp/history_file
fi
# ==================
# TTY SPECIFIC
# ==================
# set tty colors to gruvbox :)
# NOTE: To use bold font use `sudo dpkg-reconfigure console-setup` and choose TerminusBold font
# or place this in /etc/default/console-setup
# FONTFACE="TerminusBold"
if [ "$TERM" = "linux" ]; then
echo -en "\e]P01D2021" #black
echo -en "\e]P8928374" #darkgrey
echo -en "\e]P1CC241D" #darkred
echo -en "\e]P9FB4934" #red
echo -en "\e]P298971A" #darkgreen
echo -en "\e]PAB8BB26" #green
echo -en "\e]P3D79921" #brown
echo -en "\e]PBFaBD2F" #yellow
echo -en "\e]P4458588" #darkblue
echo -en "\e]PC83A598" #blue
echo -en "\e]P5B16286" #darkmagenta
echo -en "\e]PDD3869B" #magenta
echo -en "\e]P6689D6A" #darkcyan
echo -en "\e]PE8EC07C" #cyan
echo -en "\e]P7A89984" #lightgrey
echo -en "\e]PFEBDBB2" #white
clear #for background artifacting
fi
# ===============
# PROMPT
# ==============
# set a fancy prompt
case "$TERM" in
xterm-color) color_prompt=yes;;
esac
# Colored promp
force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
# load default bash_prompt
if [ -f ~/.bash/prompts/prompt_7.sh ]; then
source ~/.bash/prompts/prompt_7.sh
fi
else
PS1='\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt
# Automatically trim long paths in the prompt (requires Bash 4.x)
# PROMPT_DIRTRIM=2
# ==============
# Source all .sh and .bash files inside ./bash (only files)
for file in ~/.bash/*.sh ~/.bash/*.bash ; do
[[ -f $file ]] && source $file
done
unset file
# enable programmable completion features
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
source /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
if [ -f /usr/share/bash-completion/completions/hub ]; then
source /usr/share/bash-completion/completions/hub
fi
fi
# ============================
# ble.sh
((_ble_bash)) && ble-attach