1
0
mirror of https://git.decapod.one/brethil/dotfiles synced 2024-11-22 11:31:30 +01:00

zsh: speed up load by a factor of 3

This commit is contained in:
bretello 2020-12-08 14:32:55 +01:00
parent 96d7882471
commit 8a8d061fe4
Signed by: brethil
GPG Key ID: 876AAC6290170FE7

View File

@ -7,7 +7,11 @@ export ZSH_THEME="brethil"
export DISABLE_UNTRACKED_FILES_DIRTY=true export DISABLE_UNTRACKED_FILES_DIRTY=true
export VIRTUAL_ENV_DISABLE_PROMPT=true export VIRTUAL_ENV_DISABLE_PROMPT=true
# Source all other plugins
_ZSH_CACHE="${HOME}/.cache/zsh"
if [[ ! -d "${HOME}/.cache/zsh" ]]; then mkdir "${HOME}/.cache/zsh"; fi
# Source all zsh plugins
source <(antibody init) source <(antibody init)
antibody bundle < "$DOTFILES/antibody_plugins.txt" antibody bundle < "$DOTFILES/antibody_plugins.txt"
export ZSH="$(antibody path robbyrussell/oh-my-zsh)" export ZSH="$(antibody path robbyrussell/oh-my-zsh)"
@ -55,9 +59,14 @@ if [[ $SSH_CLIENT ]]; then
export SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock export SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock
fi fi
# pip completions # pip completion. Cache output since pip takes 0.4s to run
if which pip &>/dev/null ; then if [[ ${commands[pip]} ]]; then
eval "$(pip completion --zsh)" pip_cache_file="${_ZSH_CACHE}/pip_completion_cache.zsh"
if [[ "${commands[pip]}" -nt "${pip_cache_file}" || ! -s "$pip_cache_file" ]]; then
pip completion --zsh | sed -e "s|compctl -K [-_[:alnum:]]* pip|& pip2 pip3|" >! "$pip_cache_file" 2> /dev/null
fi
source "${pip_cache_file}"
unset pip_cache_file
fi fi
alias esource='$EDITOR $HOME/.zshrc' alias esource='$EDITOR $HOME/.zshrc'