forked from mathiasbynens/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.zsh_init
65 lines (54 loc) · 1.7 KB
/
.zsh_init
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
eval "$(starship init zsh)"
# autocomplete
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
# search with up and down
bindkey "^[[A" history-beginning-search-backward
bindkey "^[[B" history-beginning-search-forward
## Remove the beep
unsetopt LIST_BEEP
## Removes weird % sign after a curl
setopt PROMPT_CR
setopt PROMPT_SP
export PROMPT_EOL_MARK=""
## auto CD
setopt auto_cd
setopt multios
setopt prompt_subst
# nvm
export NVM_DIR="$HOME/.nvm"
## This loads nvm
[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh"
## This loads nvm bash_completion
[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm"
## This automatically runs nvm use when I go into a directory
autoload -U add-zsh-hook
load-nvmrc() {
[[ -a .nvmrc ]] || return;
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 --silent
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
# rbenv
eval "$(rbenv init - zsh)"
# Other files
source ~/.aliases
source ~/.functions
source ~/.dockermachine-config
GIT_AUTHOR_NAME="Joe d'Elia"
GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
git config --global user.name "$GIT_AUTHOR_NAME"
GIT_AUTHOR_EMAIL="joe@delia.is"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"
git config --global user.email "$GIT_AUTHOR_EMAIL"