-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathzshrc
More file actions
217 lines (180 loc) · 6.35 KB
/
Copy pathzshrc
File metadata and controls
217 lines (180 loc) · 6.35 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
205
206
207
208
209
210
211
212
213
214
215
216
217
# auto start tmux
ZSH_TMUX_AUTOSTART="false"
# if [ "$TMUX" = "" ]; then tmux; fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH=~/.oh-my-zsh
# My Theme
ZSH_THEME="spaceship"
SPACESHIP_HOST_SHOW="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git gitfast tmux kubectl ssh-agent gcloud)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
export LANG=en_US.UTF-8
export EDITOR='nvim'
export NOTES_PATH=~/Dropbox/Documents/notes
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Here comes some aliases
alias diskspace=jdiskreport
# enable aliases in sudo mode http://askubuntu.com/questions/22037/aliases-not-available-when-using-sudo
alias backup="~/bin/backup.sh"
alias f='fzf-tmux --multi --reverse -h 80% '
alias gip="~/bin/ip.sh"
alias lip="~/bin/locateip.sh"
alias r=ranger
alias sudo="sudo "
alias t=tmux
alias tm=tmux
alias tmk='tmux kill-server'
alias tmks='tmux kill-session -t '
# vim
if [[ $OSTYPE == 'darwin'* ]]; then
alias v=/opt/homebrew/bin/nvim
alias vs='/opt/homebrew/bin/nvim -S'
alias vf='/opt/homebrew/bin/nvim `fzf --preview="head -100 {}" --preview-window=right:70%:wrap`' #open files in vim using fzf for search
alias vcs='rm -rf /opt/homebrew/bin/nvim/nvim/swap' #clenaup swap files
else
alias v=~/apps/nvim.appimage
alias vs='~/apps/nvim.appimage -S'
alias vf='~/apps/nvim.appimage `fzf --preview="head -100 {}" --preview-window=right:70%:wrap`' #open files in vim using fzf for search
alias vcs='rm -rf ~/.local/share/nvim/swap' #clenaup swap files
fi
# Docker
alias d=docker
alias dps="docker ps"
alias dc=docker-compose
alias dpunit="docker_phpunit_test.sh";
alias dka="docker stop $(docker ps -a -q)" # stop all containers
# Kubectl
alias k=kubectl
# GIT
# amend and push last commit
alias !gc="git commit --amend --no-edit && gp -f"
alias gcm="git branch | grep -E 'main|master' -m 1 | awk '{print $1}' | xargs git checkout | git fetch && git pull"
alias gclean="git branch | grep -v main | xargs git branch -d"
alias gfclean="git branch | grep -v main | xargs git branch -D"
alias gb="git --no-pager branch"
#Jest
alias j="jest"
alias jw="jest --watch"
# Pyenv configuration - needs to be early in the file
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
pyenv commands 2>/dev/null | grep -qx virtualenv-init && eval "$(pyenv virtualenv-init -)"
# Local Path
export GOPATH="$HOME/Golang"
export PATH="$PATH:$GOPATH/bin"
export PATH="$PATH:~/.gem/ruby/2.4.0/bin"
export PATH="$PATH:./node_modules/.bin"
export PATH="$PATH:$HOME/bin"
export PATH="$PATH:~/.config/composer/vendor/bin"
export PATH="$PATH:~/.composer/vendor/bin/"
export PATH="$PATH:/home/$USER/.local/bin"
export PATH=/usr/local/bin:$PATH
export PATH="/home/fwd/.deno/bin:$PATH"
export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Direnv configuration
if command -v direnv >/dev/null; then
eval "$(direnv hook zsh)"
fi
# OS Specific
if [[ $OSTYPE == 'darwin'* ]]; then
# OSX
eval "$(/opt/homebrew/bin/brew shellenv)"
elif grep -qi microsoft /proc/version; then
# WSL
# set browser for WSL
export BROWSER=/mnt/c/Program\ Files/Google/Chrome/Application/chrome.exe
# needed to start tmux on remote servers
[[ $TERM == xterm-termite ]] && export TERM=xterm
fi
#python
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
# mcfly
eval "$(mcfly init zsh)"
# pnpm
export PNPM_HOME="/Users/federicoweber/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
# opperator
export PATH=/Users/federicoweber/.opperator/bin:$PATH
# TOWN
export TOWN_EMAIL_HUB_PROJECTS=~/town_projects
# Email Hub multi-checkout — thin wrapper around ~/bin/twn-p so we can cd
# in the current shell. The script handles help, setup, and the tmux layout;
# cd and `--run` need shell state so they stay here.
twn-p() {
local dir num
dir=$(command twn-p "$@") || return $?
[ -n "$dir" ] || return 0
cd "$dir" || return 1
local arg
for arg in "$@"; do
case "$arg" in
''|*[!0-9]*) ;;
*) num="$arg" ;;
esac
done
for arg in "$@"; do
case "$arg" in
-r|--run)
# zsh does not word-split unquoted expansions, so `${num:+-n "$num"}`
# passed a single `-n 2` argument; the stack ignored it and auto-picked
# the lowest free instance (i.e. 3010 instead of 3020). Use an array.
local -a nargs
nargs=()
[ -n "$num" ] && nargs=(-n "$num")
# Toolchain is pinned in mise.toml (.nvmrc was removed in e561ab5352).
# Fall back to nvm for older pre-Mise checkouts that still ship .nvmrc.
if [ -x ./mise ]; then
./mise run local-stack -- "${nargs[@]}"
else
source "${NVM_DIR:-$HOME/.nvm}/nvm.sh" && nvm use && bun scripts/local-convex-backend.ts "${nargs[@]}"
fi
return
;;
esac
done
}
# Claude
export PATH="$HOME/.local/bin:$PATH"
# NVM (must be after Homebrew to ensure nvm's node takes priority)
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
# use nvm version for the given folder
load-nvmrc() {
if ! command -v nvm > /dev/null 2>&1; then
echo "nvm is not installed. Skipping nvm use."
return 0
fi
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