Skip to content

Commit ec05d50

Browse files
committed
optimize configs
1 parent 5126a2b commit ec05d50

1 file changed

Lines changed: 34 additions & 9 deletions

File tree

zsh/conf.d/zshrc

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,21 @@ setopt hist_ignore_dups
1010
setopt EXTENDED_HISTORY
1111

1212
### zsh completion
13-
fpath+=~/.zfunc
14-
if type brew &>/dev/null
15-
then
16-
FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}"
17-
fi
13+
autoload -Uz compinit
14+
if [[ -n ${ZDOTDIR}/.zcompdump(#qN.mh+24) ]]; then
15+
compinit;
16+
else
17+
compinit -C;
18+
fi;
1819
export LS_COLORS='di=01;34:ln=01;35:so=01;32:ex=01;31:bd=46;34:cd=43;34:su=41;30:sg=46;30:tw=42;30:ow=43;30'
19-
autoload -Uz compinit ; compinit
2020
autoload -U colors ; colors ; zstyle ':completion:*' list-colors "${LS_COLORS}"
2121
zstyle ':completion:*' completer _complete _match _approximate
2222
zstyle ':completion:*' menu select
2323
zstyle ':completion::complete:*' use-cache true
2424
zstyle ':completion:*:approximate:*' max-errors 3 numeric
2525
zstyle ':completion:*:sudo:*' command-path /usr/local/sbin /usr/local/bin \
2626
/usr/sbin /usr/bin /sbin /bin /usr/X11R6/bin
27-
28-
### zsh utils
27+
# zsh utils
2928
autoload -Uz edit-command-line
3029
zle -N edit-command-line
3130
bindkey "^O" edit-command-line
@@ -109,7 +108,14 @@ fi
109108

110109
### anyenv
111110
if is_exists anyenv; then
112-
eval "$(anyenv init - zsh)"
111+
export PATH="$HOME/.anyenv/bin:$PATH"
112+
# eval "$(anyenv init --no-rehash - zsh)"
113+
if ! [ -f ~/.cache/anyenv.cache ]
114+
then
115+
anyenv init - --no-rehash > ~/.cache/anyenv.cache
116+
zcompile ~/.cache/anyenv.cache
117+
fi
118+
source ~/.cache/anyenv.cache
113119
fi
114120

115121
### direnv
@@ -167,3 +173,22 @@ case ${OSTYPE} in
167173
fi
168174
;;
169175
esac
176+
177+
if [ -d ${HOME}/.nvm ]; then
178+
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
179+
180+
nvm() {
181+
unset -f nvm
182+
source "${NVM_DIR}/nvm.sh"
183+
nvm "$@"
184+
}
185+
186+
if [ -f "${NVM_DIR}/alias/default" ]; then
187+
DEFAULT_NODE_VERSION=$(cat "${NVM_DIR}/alias/default")
188+
NODE_BIN_PATH="${NVM_DIR}/versions/node/v${DEFAULT_NODE_VERSION}/bin"
189+
if [ -d "${NODE_BIN_PATH}" ]; then
190+
export PATH="${NODE_BIN_PATH}:$PATH"
191+
export NODE_PATH="${NVM_DIR}/versions/node/v${DEFAULT_NODE_VERSION}/lib/node_modules"
192+
fi
193+
fi
194+
fi

0 commit comments

Comments
 (0)