-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zshrc
44 lines (35 loc) · 1.22 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
PROMPT='$ %F{cyan}%~%f: '
# Always show helpers
alias ls="ls -F"
export GREP_OPTIONS="--color=auto"
export NVM_DIR="/Users/bchanx/.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
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 "$(/bin/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
# Make zsh tab behave like bash
setopt noautomenu
setopt nomenucomplete
# Map home and end keys so fn+left and fn+right work
# when in terminal and in vim
# https://apple.stackexchange.com/questions/419657/how-do-i-get-home-and-end-working-for-both-iterm2-and-vim
bindkey "^[[H" beginning-of-line
bindkey "^[[F" end-of-line
# usr/bin
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"