-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bashrc
179 lines (135 loc) · 4.8 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
##############################################
# matzxrr bash
# ############################################
default_username='matzxrr'
# Not a ZSH script
if [[ -n "$ZSH_VERSION" ]]; then
return 1 2> /dev/null || exit 1;
fi;
# Load Work cmds
IE="$HOME/.ie"
if [ -f "$IE" ]; then
. "$IE"
fi
unset IE
# Setup Glyphs
USER_ICON=''
PENGUIN_ICON=''
APPLE_ICON=''
FOLDER_ICON=''
SERVER_ICON=''
GIT_ICON=''
MULTI_FIRST='╭─'
MULTI_LAST='╰'
# Get Logo by System Type
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) MACHINE=$PENGUIN_ICON;;
Darwin*) MACHINE=$APPLE_ICON;;
*) MACHINE=$PENGUIN_ICON;;
esac
set_prompts() {
# See the color table...
# for c in {0..255}; do tput setaf $c; tput setaf $c | cat -v; echo =$c; done
local black="" blue="" bold="" cyan="" green="" orange="" \
purple="" red="" reset="" white="" yellow=""
local dateCmd=""
if [ -x /usr/bin/tput ] && tput setaf 1 &> /dev/null; then
tput sgr0 # Reset colors
bold=$(tput bold)
reset=$(tput sgr0)
black=$(tput setaf 000)
red=$(tput setaf 001)
green=$(tput setaf 002)
yellow=$(tput setaf 003)
blue=$(tput setaf 004)
purple=$(tput setaf 005)
teal=$(tput setaf 006)
silver=$(tput setaf 007)
charcoal=$(tput setaf 008)
else
bold=""
reset="\e[0m"
black="\e[1;000m"
red="\e[1;001m"
green="\e[1;002m"
yellow="\e[1;003m"
blue="\e[1;004m"
purple="\e[1;005m"
teal="\e[1;006m"
silver="\e[1;007m"
charcoal="\e[1;008m"
fi
# Only show username/host if not default
function usernamehost() {
userhost="${silver}$MULTI_FIRST"
userhost+="${yellow} $MACHINE $USER "
userhost+="${teal}at "
userhost+="${purple}$SERVER_ICON $HOSTNAME "
userhost+="${teal}in"
homeuser="${silver}$MULTI_FIRST"
homeuser+="${yellow} $MACHINE $default_username "
if [ $USER != "$default_username" ]; then
echo $userhost "";
else
echo $homeuser "";
fi
}
function prompt_git() {
# check if we're in a git repo. (fast)
git rev-parse --is-inside-work-tree &>/dev/null || return
# Get branch Name
branchName="$(git symbolic-ref HEAD 2>/dev/null)" || branchName="(unnamed branch)" # detached HEAD
branchName=${branchName##refs/heads/}
# check if it's dirty
if [[ -n $(git status --porcelain) ]]; then
dirty="*";
fi
# mathias has a few more checks some may like:
# github.com/mathiasbynens/dotfiles/blob/a8bd0d4300/.bash_prompt#L30-L43
echo "${1}$GIT_ICON ${branchName}${2}$dirty";
return
}
# ------------------------------------------------------------------
# | Prompt string |
# ------------------------------------------------------------------
PS1="\[\033]0;\w\007\]" # terminal title (set to the current working directory)
PS1+="\n\[$bold\]"
PS1+="\[$(usernamehost)\]" # username at host
PS1+="\[$red\]$FOLDER_ICON \w" # working directory
PS1+="\$(prompt_git \"$teal on $yellow\" \"$cyan\")" # git repository details
if type prompt_svn &>/dev/null; then
PS1+="\$(prompt_svn \"$yellow\")" # prompt svn
fi
PS1+="\n"
PS1+="\[$silver\]$MULTI_LAST \[$reset\]"
export PS1
# ------------------------------------------------------------------
# | Subshell prompt string |
# ------------------------------------------------------------------
export PS2="\[$red\] \[$reset\]"
}
# ----------------------------------------------------------------------
# | Path Updates |
# ----------------------------------------------------------------------
export PATH=/opt/diff-so-fancy:$PATH
export PATH=/home/$USER/.local/share/bob/nvim-bin:$PATH
export PATH="$PATH:/home/$USER/.local/bin"
export PATH="$PATH:/usr/local/go/bin"
export BASH_SILENCE_DEPRECATION_WARNING=1
export HOMEBREW_BUNDLE_FILE=~/.config/.brewfile
export EDITOR=hx
export HELIX_RUNTIME="$HOME/helix/runtime"
export GPG_TTY=$(tty) # Fix gpg signing
set_prompts
unset set_prompts
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
RUSTUP="$HOME/.cargo/env"
if [ -f "$RUSTUP" ]; then
. "$RUSTUP"
fi
unset RUSTUP
## My Aliases
alias config='/usr/bin/git --git-dir=$HOME/.cfg/ --work-tree=$HOME'