-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdot_zshrc.tmpl
More file actions
131 lines (112 loc) · 3.68 KB
/
Copy pathdot_zshrc.tmpl
File metadata and controls
131 lines (112 loc) · 3.68 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
# Cross-platform zshrc managed by chezmoi
# OS: {{ .chezmoi.os }}
################################################################################
# Oh-My-Zsh Setup
################################################################################
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
plugins=(
git
history
npm
nvm
docker
tmux
poetry
{{- if eq .chezmoi.os "darwin" }}
iterm2
{{- end }}
)
source $ZSH/oh-my-zsh.sh
################################################################################
# PATH Configuration
################################################################################
{{- if eq .chezmoi.os "darwin" }}
# macOS Homebrew paths
export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:$PATH"
export PATH="/opt/homebrew/opt/libpq/bin:$PATH"
export PNPM_HOME="$HOME/Library/pnpm"
{{- else }}
# Linux Linuxbrew paths
export PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH"
export PNPM_HOME="$HOME/.local/share/pnpm"
{{- end }}
# Common paths
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
# pnpm
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
################################################################################
# nvm
################################################################################
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# Auto-switch node version on .nvmrc
autoload -U add-zsh-hook
load-nvmrc() {
local node_version="$(nvm version)"
local nvmrc_path="$(nvm_find_nvmrc)"
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")
if [ "$nvmrc_node_version" = "N/A" ]; then
nvm install
elif [ "$nvmrc_node_version" != "$node_version" ]; then
nvm use
fi
elif [ "$node_version" != "$(nvm version default)" ]; then
echo "Reverting to nvm default version"
nvm use default
fi
}
add-zsh-hook chpwd load-nvmrc
load-nvmrc
################################################################################
# pyenv
################################################################################
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
################################################################################
# Terraform Completion
################################################################################
autoload -U +X bashcompinit && bashcompinit
{{- if eq .chezmoi.os "darwin" }}
complete -o nospace -C /opt/homebrew/bin/terraform terraform
{{- else }}
complete -o nospace -C /home/linuxbrew/.linuxbrew/bin/terraform terraform
{{- end }}
################################################################################
# Aliases
################################################################################
# Neovim
alias vim="nvim"
alias vimdiff="nvim -d"
alias v=nvim
export EDITOR="nvim"
# Lazygit
alias c=lazygit
export CONFIG_DIR=$HOME/.config/lazygit
# Chezmoi
alias cz="chezmoi"
alias cze="chezmoi edit"
alias cza="chezmoi apply"
alias czd="chezmoi diff"
# Cloud CLI aliases
alias tf="terraform"
alias tfi="terraform init"
alias tfp="terraform plan"
alias tfa="terraform apply"
alias g="gcloud"
alias gcl="gcloud config list"
alias gcs="gcloud config set"
alias azl="az login"
alias azs="az account set"
alias azls="az account list --output table"
################################################################################
# Starship Prompt
################################################################################
eval "$(starship init zsh)"