Speedup zsh startup time

This commit is contained in:
Hunter Haugen 2018-09-20 10:12:22 -07:00
parent 02320e00d4
commit 0b184c6509
Signed by: hunner
GPG key ID: EF99694AA599DDAD

36
.zshrc
View file

@ -1,8 +1,10 @@
## Profiling options ## Profiling options
#PS4='+$(date "+%s:%N") %N:%i> ' PROFILE_STARTUP=false
#exec 3>&2 2>/tmp/zsh-startlog.$$ if [[ "$PROFILE_STARTUP" == true ]]; then
#setopt prompt_subst PS4=$'%D{%M%S%.} %N:%i> '
#setopt xtrace exec 3>&2 2>/tmp/zsh-startlog.$$
setopt xtrace prompt_subst
fi
typeset -ga preexec_functions typeset -ga preexec_functions
typeset -ga precmd_functions typeset -ga precmd_functions
@ -58,16 +60,16 @@ for dir in $paths ; do
if [ -d $dir ] ; then if [ -d $dir ] ; then
export PATH=$PATH:$dir export PATH=$PATH:$dir
fi fi
if [ -d `dirname $dir`/man ] ; then if [ -d ${dir:a:h}/man ] ; then
export MANPATH=$MANPATH:`dirname $dir`/man export MANPATH=$MANPATH:${dir:a:h}/man
fi fi
done done
for dir in $prepaths ; do for dir in $prepaths ; do
if [ -d $dir ] ; then if [ -d $dir ] ; then
export PATH=$dir:$PATH export PATH=$dir:$PATH
fi fi
if [ -d `dirname $dir`/man ] ; then if [ -d ${dir:a:h}/man ] ; then
export MANPATH=`dirname $dir`/man:$MANPATH export MANPATH=${dir:a:h}/man:$MANPATH
fi fi
done done
# Load profiles from /etc/profile.d # Load profiles from /etc/profile.d
@ -112,7 +114,6 @@ export OVFTOOL='/Applications/VMware OVF Tool/ovftool'
if whence rg > /dev/null ; then if whence rg > /dev/null ; then
export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --glob "!.git/*"' export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --glob "!.git/*"'
fi fi
eval "$(hub alias -s)"
# Prompt # Prompt
#prompt_precmd() { #prompt_precmd() {
@ -268,6 +269,7 @@ alias wd="dtach -a ~/.dtach-weechat"
alias eo="xmodmap ~/keymaps/eo_dv_hunner.pke" alias eo="xmodmap ~/keymaps/eo_dv_hunner.pke"
alias vt="export TERM=vt220" alias vt="export TERM=vt220"
alias rm=rm; unalias rm #hack alias rm=rm; unalias rm #hack
alias git="hub"
alias gs="git status" alias gs="git status"
alias gl="git lg" alias gl="git lg"
alias gla="git lg --all" alias gla="git lg --all"
@ -472,13 +474,15 @@ ex () {
if [ -d ~/.rbenv ] ; then if [ -d ~/.rbenv ] ; then
eval "$(rbenv init -)" eval "$(rbenv init -)"
fi fi
pyenv() {
if [ -d ~/.pyenv ] ; then if [ -d ~/.pyenv ] ; then
eval "$(pyenv init -)" eval "$(command pyenv init -)"
pyenv "$@"
else
echo "pyenv isn't installed"
fi fi
}
#[ -f ~/.zsh-fuzzy-match/fuzzy-match.zsh ] && source ~/.zsh-fuzzy-match/fuzzy-match.zsh #[ -f ~/.zsh-fuzzy-match/fuzzy-match.zsh ] && source ~/.zsh-fuzzy-match/fuzzy-match.zsh
## Profiling options
#unsetopt xtrace
#exec 2>&3 3>&-
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
@ -490,3 +494,9 @@ if [ -f '/Users/hunner/google-cloud-sdk/path.zsh.inc' ]; then source '/Users/hun
# The next line enables shell command completion for gcloud. # The next line enables shell command completion for gcloud.
if [ -f '/Users/hunner/google-cloud-sdk/completion.zsh.inc' ]; then source '/Users/hunner/google-cloud-sdk/completion.zsh.inc'; fi if [ -f '/Users/hunner/google-cloud-sdk/completion.zsh.inc' ]; then source '/Users/hunner/google-cloud-sdk/completion.zsh.inc'; fi
## Profiling options
if [[ "$PROFILE_STARTUP" == true ]]; then
unsetopt xtrace
exec 2>&3 3>&-
fi