-
Notifications
You must be signed in to change notification settings - Fork 0
/
zshrc
174 lines (138 loc) · 4.86 KB
/
zshrc
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
# 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"
DEFAULT_USER="fwd"
# 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)
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"
# 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
# NVM
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
# 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
# Python Pyenv
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
# OS Specific
if [[ $OSTYPE == 'darwin'* ]]; then
# OSX
echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/fwd/.zprofile
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/fwd/.zprofile
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)"
# Direnv needed for Trunk
eval "$(direnv hook zsh)"
# pnpm
export PNPM_HOME="/Users/fwd/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
# pnpm end
test -f /Users/fwd/.cache/trunk/shell-hooks/zsh.rc && source /Users/fwd/.cache/trunk/shell-hooks/zsh.rc;