Repository navigation
Expand file tree
/
Copy pathbashrc
More file actions
204 lines (165 loc) · 5.7 KB
/
Copy pathbashrc
File metadata and controls
204 lines (165 loc) · 5.7 KB
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
#!/usr/bin/env bash
_EMPLOYER="google"
if [[ $(uname -s) == "Darwin" ]]; then
export HOMEBREW_NO_ASK=1
fi
# This makes Ctrl-S (forward-search-history) work.
stty stop undef
export HISTSIZE=100000 #bash history will save this many commands
export HISTFILESIZE=${HISTSIZE} #bash will remember this many commands
export HISTCONTROL=ignoredups #ignore duplicate commands
export HISTIGNORE="cd:ls:clear" #don't put these in the history
export HISTTIMEFORMAT="[%Y-%m-%d - %H:%M:%S] " #timestamps
shopt -s cmdhist # save multi-line commands as a single line in the history.
shopt -s expand_aliases # expand aliases in this file.
shopt -s histappend # append to the history file instead of overwriting
pcp() {
if [ -d "$2" ]; then
pv "$1" >"$2"/"$1"
else
pv "$1" >"$2"
fi
}
#Regular Colors
txtblk='\[\e[0;30m\]' # Black
txtred='\[\e[0;31m\]' # Red
txtgrn='\[\e[0;32m\]' # Green
txtylw='\[\e[0;33m\]' # Yellow
txtblu='\[\e[0;34m\]' # Blue
txtpur='\[\e[0;35m\]' # Purple
txtcyn='\[\e[0;36m\]' # Cyan
txtwht='\[\e[0;37m\]' # White
#Bold Colors
bldblk='\[\e[1;30m\]' # Black
bldred='\[\e[1;31m\]' # Red
bldgrn='\[\e[1;32m\]' # Green
bldylw='\[\e[1;33m\]' # Yellow
bldblu='\[\e[1;34m\]' # Blue
bldpur='\[\e[1;35m\]' # Purple
bldcyn='\[\e[1;36m\]' # Cyan
bldwht='\[\e[1;37m\]' # White
#Underlined Colors
unkblk='\[\e[4;30m\]' # Black
undred='\[\e[4;31m\]' # Red
undgrn='\[\e[4;32m\]' # Green
undylw='\[\e[4;33m\]' # Yellow
undblu='\[\e[4;34m\]' # Blue
undpur='\[\e[4;35m\]' # Purple
undcyn='\[\e[4;36m\]' # Cyan
undwht='\[\e[4;37m\]' # White
#Background Colors
bakblk='\[\e[40m\]' # Black
bakred='\[\e[41m\]' # Red
badgrn='\[\e[42m\]' # Green
bakylw='\[\e[43m\]' # Yellow
bakblu='\[\e[44m\]' # Blue
bakpur='\[\e[45m\]' # Purple
bakcyn='\[\e[46m\]' # Cyan
bakwht='\[\e[47m\]' # White
txtrst='\[\e[0m\]' # Text Reset
cleanup() {
ls | while read -r FILE; do
mv -v "$FILE" $(echo $FILE | tr ' ' '_' | tr -d '[{}(),\!]:"' | tr -d "\'" | tr '[A-Z]' '[a-z]' | tr '&' 'n' | sed 's/_-_/_/g')
done
}
update_prompt() {
RET=$?
#TODO: Fix these.
#history -a #write the current terminal's history to the history file
#history -n
# https://wiki.archlinux.org/index.php/Color_Bash_Prompt#Advanced_return_value_visualisation
# Basically, prepend the prompt with a green 0 if the last command returned 0, or prepend it with a red $error_code if not.
RET_VALUE="$(if [[ $RET == 0 ]]; then echo -ne "${bldgrn}$RET"; else echo -ne "${bldred}$RET"; fi)"
# If I'm root, use a red prompt. Green otherwise.
if [[ ${EUID} == 0 ]]; then
_color="${bldred}"
else
_color="${bldgrn}"
fi
# On a Mac (read: my workstation), just show the return value and working directory.
if [[ $(uname -s) == "Linux" ]]; then
# On Linux, show the user and hostname too.
PS1="${_color}\u${bldblu}@${_color}\h "
PS1="${PS1}${bldblu}[${txtrst}\w${bldblu}]"
fi
PS1="$PS1"
#http://www.fileformat.info/info/unicode/char/26a1/index.htm
PS1="$PS1${bldblu}⚡ ${txtrst}"
# Set the term title to user@host: working_dir
PS1="\[\e]0;\u@\h: \w\a\]$PS1"
PS1="$RET_VALUE $PS1"
}
PROMPT_COMMAND=update_prompt
alias :w='echo "lol"'
#http://www.debianadmin.com/pv-pipe-viewer-shell-pipeline-element-to-meter-data-passing-through.html/comment-page-1#comment-3739
alias rscp='rsync -aP --no-whole-file --inplace'
alias rsmv='rscp --remove-source-files'
alias less='less -N' # show line numbers when I invoke `less` myself, but not for `man`.
alias f='find . | grep -i' # useful for finding files within the current directory.
alias p='ping google.com'
alias m='make'
alias c='clear'
alias x='clear' # what is this X you speak of?
if [[ -f "/usr/local/bin/hub" ]]; then
alias git=hub
fi
export LESS="-IMR" # search case insensitively, prompt verbosely (i.e. show percentage through the file) and repaint the screen, useful when a file is changing as you're reading it.
alias path='echo -e ${PATH//:/\\n}' # print path components, one per line.
# http://superuser.com/questions/36022/less-and-grep-color
# Print the filename and don't search binary files. Note that if you're
# piping stuff through grep, the `-H` will annoy you. So I call `env
# grep` in pipelines.
alias grep='grep --color=always -HI'
# I have a `git-new` script in here that I use to see new Homebrew
# formulae. I never use it, but why not.
export PATH="$HOME/dotfiles/bin:$PATH"
# For gitolite.
export PATH="$HOME/bin:$PATH"
export PATH="$HOME/go/bin:$PATH"
if [[ -f ~/.bash_profile ]]; then
_HERE=$(
cd $(dirname $(readlink ~/.bash_profile))
pwd
)
elif [[ -f ~/.bashrc ]]; then
_HERE=$(
cd $(dirname $(readlink ~/.bashrc))
pwd
)
fi
if [[ "$(uname)" == "Linux" ]]; then
PAGER=less
# LESS man page colors
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
if [[ -f /etc/bash_completion ]]; then
. /etc/bash_completion
fi
alias ls='ls --color=auto -p --group-directories-first'
alias pstree='pstree -ap' # args & PID
if [[ -s "$HOME/.bash_profile" ]]; then
. "$HOME/.bash_profile"
fi
fi
if [[ -f $HOME/my_src/private/${_EMPLOYER}_rc ]]; then
. $HOME/my_src/private/${_EMPLOYER}_rc
fi
if [[ -d $HOME/.cargo/bin ]]; then
export PATH=$PATH:$HOME/.cargo/bin
fi
if [[ -f /usr/share/autojump/autojump.sh ]]; then
. /usr/share/autojump/autojump.sh
fi
. "$HOME/.cargo/env"
# Added by LM Studio CLI (lms)
export PATH="$PATH:/Users/matt/.lmstudio/bin"
# End of LM Studio CLI section
# Added by Antigravity CLI installer
export PATH="/Users/matt/.local/bin:$PATH"
# Added by Antigravity CLI installer
export PATH="/Users/matthew/.local/bin:$PATH"