-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbash_custom
71 lines (52 loc) · 2.02 KB
/
bash_custom
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
#!/bin/bash
# Allow __git_ps1 to work on arch linux
[[ -f /usr/share/git/git-prompt.sh ]] && . /usr/share/git/git-prompt.sh
export GIT_PS1_SHOWDIRTYSTATE=1
export GIT_PS1_SHOWSTASHSTATE=1
export GIT_PS1_SHOWUNTRACKEDFILES=1
get_ps1() {
local blue="\[\033[01;34m\]"
local white="\[\033[01;00m\]"
local magenta="\[\033[01;35m\]"
local pink="\[\033[01;31m\]"
local green="\[\033[01;32m\]"
# Assign a pseudo-random color to the hostname string based on hostname value
local hostname_number=$(hostname | od | tr ' ' '\n' | awk '{total = total + $1}END{print 30 + (total % 6)}')
local hostname_color="\[\033[01;${hostname_number}m\]"
local user="${blue}\u${white}"
local host="${hostname_color}\h${white}"
local dir="${green}\w${white}"
local time="${green}\$(date \"+%H:%M:%S\")${white}"
local git="${green}\$(__git_ps1 '%s')${white}"
echo "${user}@${host} ${dir} ${git}\n${time} $ "
}
# Lets try starship for now
# PS1="$(get_ps1)"
# Increase the amount of history bash will store and reload
export HISTFILE=~/.history
export HISTSIZE=
export HISTFILESIZE=
# Allows for sharing of history across tmux sessions and panes
# "-a" immediately appends new history to the histfile
export PROMPT_COMMAND='history -a'
# Ignore and erase duplicates and commands with leading whitespace
export HISTCONTROL=ignoreboth:erasedups
export EDITOR=nvim
export SOPS_AGE_KEY_FILE="${HOME}/workspace/dotfiles/secret/sops-age-key.txt"
export PYTHONDONTWRITEBYTECODE=1
# Platform dependant stuff
if [[ "$(uname)" == 'Linux' ]]; then
. "${HOME}/.bash_linux"
. "${HOME}/.aliases_linux"
elif [[ "$(uname)" == 'Darwin' ]]; then
. "${HOME}/.bash_mac"
. "${HOME}/.aliases_mac"
fi
[[ -f ~/.aliases ]] && . ~/.aliases
[[ -f ~/.bash_secret ]] && . ~/.bash_secret
[[ -f ~/.distraction ]] && . ~/.distraction
[[ -f "$HOME/.cargo/env" ]] && . "$HOME/.cargo/env"
export PATH="${HOME}/.local/bin:$HOME/.cargo/bin:$HOME/bin:$HOME/go/bin:$PATH"
source <(~/.local/bin/mise completion bash)
eval "$(~/.local/bin/mise activate bash)"
eval "$(starship init bash)"