-
Notifications
You must be signed in to change notification settings - Fork 0
/
.bashrc
79 lines (66 loc) · 2.2 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
# brew
eval "$(/opt/homebrew/bin/brew shellenv)"
# go: switch go versions using brew
genv() {
brew install go@$1
brew unlink go
brew link go@$1 --overwrite --force
go version
}
# prompt: branch for prompt
branch_name() {
local branch=$(git branch 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
if [[ $branch != "" ]]; then
echo ' ['$branch']'
fi
}
# prompt: format the line
prompt_line() {
local _GREEN=$(tput setaf 2)
local _BLUE=$(tput setaf 4)
local _RESET=$(tput sgr0)
echo "\[${_BLUE}\]\W\[${_RESET}${_GREEN}\]\$(branch_name)\[${_RESET}\] \$ \[\e[0m\]"
}
# history: quickly grep
hs() {
history | grep "${1}"
}
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/petesaia/code/google-cloud-sdk/path.bash.inc' ]; then . '/Users/petesaia/code/google-cloud-sdk/path.bash.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/petesaia/code/google-cloud-sdk/completion.bash.inc' ]; then . '/Users/petesaia/code/google-cloud-sdk/completion.bash.inc'; fi
# env
export PS1=$(prompt_line)
export CODE_PATH="${HOME}/code"
export GO111MODULE=on
export GOROOT="${HOME}/go/go1.22.3"
export GOBIN="${GOROOT}/bin"
export GOPATH="${GOROOT}/versioned_packages"
export N_PREFIX="${CODE_PATH}/node_versions"
export PATH="${GOBIN}:$PATH:${CODE_PATH}/istio-1.16.1/bin"
export NVM_DIR="$HOME/.nvm"
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion
# git: dotfile management
alias config='git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
# rust: things
if [[ -d "$HOME/.cargo" ]]; then . "$HOME/.cargo/env"; fi
# misc aliases
alias k=kubectl
alias vim="nvim"
alias vi="nvim"
export EDITOR=nvim
# direnv: install
eval "$(direnv hook bash)"
# history: always append, a lot of lines, and important stuff
shopt -s histappend
shopt -s cmdhist
HISTFILESIZE=1000000
HISTSIZE=1000000
HISTIGNORE='ls:bg:fg:history:cd'
HISTTIMEFORMAT='%F %T '
PROMPT_COMMAND='history -a'
# source things I'd like to keep out of git
if [[ -f "$HOME/.bashrcs" ]]; then
source $HOME/.bashrcs
fi