zsh 大部分情况下启动时间约为 0.4 秒,但有时需要约 3 秒

zsh 大部分情况下启动时间约为 0.4 秒,但有时需要约 3 秒

最近,我开始加快终端启动时间(通常需要超过 8 秒),方法是分析我的.zshrc。然后,我删除了不需要的东西;延迟加载了诸如nvmrvm和之类的东西pyenv;并对命令的结果进行了硬编码brew --prefix(每个命令花费约 1 秒brew!)。我将其缩短到约 0.4 秒(哇!)但偶尔会花费 3 秒以上。(我在下面附上了我的副本.zshrc)。

我跑了sort_timings.zsh(见我上面链接的文章)zsh_profile.<hash>生成文件时花费了约 3 秒的时间,我已将timings.txt以下内容附加到文件中。有很多参考资料compdumpcompinit所以我尝试这样做这个建议并添加export skip_global_compinit=1到我的顶部.zshrc但没有骰子......

任何建议我们都会非常欢迎:)

.zshrc

export skip_global_compinit=1

# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH

# Path to your oh-my-zsh installation.
export ZSH="/Users/matt/.oh-my-zsh"

# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/robbyrussell/oh-my-zsh/wiki/Themes
ZSH_THEME="robbyrussell"

# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in ~/.oh-my-zsh/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )

# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"

# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"

# Uncomment the following line to disable bi-weekly auto-update checks.
# DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to automatically update without prompting.
# DISABLE_UPDATE_PROMPT="true"

# Uncomment the following line to change how often to auto-update (in days).
# export UPDATE_ZSH_DAYS=13

# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS=true

# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"

# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"

# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
# COMPLETION_WAITING_DOTS="true"

# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"

# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"

# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in ~/.oh-my-zsh/plugins/*
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(
    zshfl
    git
    zsh-syntax-highlighting
    zsh-autosuggestions
    zsh-completions
    fasd
    pyenv-lazy
)

source $ZSH/oh-my-zsh.sh

# User configuration

# export MANPATH="/usr/local/man:$MANPATH"

# You may need to manually set your language environment
# export LANG=en_US.UTF-8

# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
#   export EDITOR='vim'
# else
#   export EDITOR='mvim'
# fi

# Compilation flags
# export ARCHFLAGS="-arch x86_64"

# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"

# path to Homebrew
PATH=$HOME/bin:/usr/local/bin:$PATH

if [ -z "$INTELLIJ_ENVIRONMENT_READER" ]; then
    # iTerm2 Shell Integration
    test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"

    # use Python 3 when default "python" is called
    export PATH=/usr/local/bin:/usr/local/sbin:${PATH}
    export PATH=${PATH}:/Users/matt/Library/Python/3.7/bin
    export PATH="/usr/local/opt/python/libexec/bin:/usr/local/bin:$PATH"

    # undo and redo for iTerm
    bindkey "^U" backward-kill-line
    bindkey "^X\x7f" backward-kill-line
    bindkey "^X^_" redo

    # source git-extras to zsh
    source /usr/local/opt/git-extras/share/git-extras/git-extras-completion.zsh

    # so `pio` and `platformio` CLI is in PATH
    export PATH=$PATH:~/.platformio/penv/bin

    # for THEOS & iOS tweak development
    export THEOS=~/theos
    export THEOS_DEVICE_IP=localhost
    export THEOS_DEVICE_PORT=2222
    export PATH="/Users/matt/theos/bin:$PATH"

    # for Homebrew to upgrade every 24 hours, instead of every brew command, which is annoying
    export HOMEBREW_AUTO_UPDATE_SECS="86400"

    # add brew to PATH
    export PATH="/usr/local/bin:/usr/local/sbin:$PATH"

    # set gpu to git push -u instead
    alias gpu="git push -u"

    # set gop to git push (I keep mistyping it)
    alias gop="git push"

    # set default browser to Firefox Developer Edition
    export BROWSER="firefox"

    # add gmm as git merge master/main
    alias gmm="gmom"

    # add gstst as stash staged changes only
    alias gstst="git move-staged"

    # add killport as function to kill a port
    killport() {
        local PIDs=$(lsof -t -i:$1)
        echo "killing process(es) on port $1 with PID(s): $(echo -e $PIDs | xargs | sed 's/ /, /g')"
        echo -e $PIDs | xargs kill
    }

    # for dequarantining apps
    dequarantine() {
        local abs_app_path=$(greadlink -m $1)
        echo "dequarantining .app at path $abs_app_path..."
        xattr -dr com.apple.quarantine $abs_app_path
        echo "DONE."
    }

    # add function to select default JDK version
    jdk() {
        version=$1
        export JAVA_HOME=$(/usr/libexec/java_home -v"$version");
        java -version
    }

    ghr() {
        file=$1
        git restore --staged $file
        git restore $file
    }

    # add alias for committing with commitizen
    alias nrc="npm run commit"

    # add alias for bumping version with standard-version
    alias nrr="npm run release"

    # resolve caveats of homebrew's curl 
    export PATH="/usr/local/opt/curl/bin:$PATH"
    export LDFLAGS="$LDFLAGS -L/usr/local/opt/curl/lib"
    export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/curl/include"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/curl/lib/pkgconfig"

    # brew prefix (hardcoded for speedups)
    export BREW_PREFIX="/usr/local"

    # add asdf-vm to shell
    . $BREW_PREFIX/opt/asdf/libexec/asdf.sh

    # make zsh-pyenv-lazy also call `eval "$(pyenv virtualenv-init -)"`
    export ZSH_PYENV_LAZY_VIRTUALENV=true

    # automatically activates anaconda base virtualenv
    # note: we hardcode the conda initialize script contents for speedups
    # >>> conda initialize >>>
    # !! Contents within this block are managed by 'conda init' !!
    export CONDA_EXE='/usr/local/anaconda3/bin/conda'
    export _CE_M=''
    export _CE_CONDA=''
    export CONDA_PYTHON_EXE='/usr/local/anaconda3/bin/python'

    # Copyright (C) 2012 Anaconda, Inc
    # SPDX-License-Identifier: BSD-3-Clause

    __add_sys_prefix_to_path() {
        # In dev-mode CONDA_EXE is python.exe and on Windows
        # it is in a different relative location to condabin.
        if [ -n "${_CE_CONDA}" ] && [ -n "${WINDIR+x}" ]; then
            SYSP=$(dirname "${CONDA_EXE}")
        else
            SYSP=$(dirname "${CONDA_EXE}")
            SYSP=$(dirname "${SYSP}")
        fi

        if [ -n "${WINDIR+x}" ]; then
            PATH="${SYSP}/bin:${PATH}"
            PATH="${SYSP}/Scripts:${PATH}"
            PATH="${SYSP}/Library/bin:${PATH}"
            PATH="${SYSP}/Library/usr/bin:${PATH}"
            PATH="${SYSP}/Library/mingw-w64/bin:${PATH}"
            PATH="${SYSP}:${PATH}"
        else
            PATH="${SYSP}/bin:${PATH}"
        fi
        export PATH
    }

    __conda_exe() (
        __add_sys_prefix_to_path
        "$CONDA_EXE" $_CE_M $_CE_CONDA "$@"
    )

    __conda_hashr() {
        if [ -n "${ZSH_VERSION:+x}" ]; then
            rehash
        elif [ -n "${POSH_VERSION:+x}" ]; then
            :  # pass
        else
            hash -r
        fi
    }

    __conda_activate() {
        if [ -n "${CONDA_PS1_BACKUP:+x}" ]; then
            # Handle transition from shell activated with conda <= 4.3 to a subsequent activation
            # after conda updated to >= 4.4. See issue #6173.
            PS1="$CONDA_PS1_BACKUP"
            unset CONDA_PS1_BACKUP
        fi
        local ask_conda
        ask_conda="$(PS1="${PS1:-}" __conda_exe shell.posix "$@")" || return
        eval "$ask_conda"
        __conda_hashr
    }

    __conda_reactivate() {
        local ask_conda
        ask_conda="$(PS1="${PS1:-}" __conda_exe shell.posix reactivate)" || return
        eval "$ask_conda"
        __conda_hashr
    }

    conda() {
        local cmd="${1-__missing__}"
        case "$cmd" in
            activate|deactivate)
                __conda_activate "$@"
                ;;
            install|update|upgrade|remove|uninstall)
                __conda_exe "$@" || return
                __conda_reactivate
                ;;
            *)
                __conda_exe "$@"
                ;;
        esac
    }

    if [ -z "${CONDA_SHLVL+x}" ]; then
        export CONDA_SHLVL=0
        # In dev-mode CONDA_EXE is python.exe and on Windows
        # it is in a different relative location to condabin.
        if [ -n "${_CE_CONDA:+x}" ] && [ -n "${WINDIR+x}" ]; then
            PATH="$(dirname "$CONDA_EXE")/condabin${PATH:+":${PATH}"}"
        else
            PATH="$(dirname "$(dirname "$CONDA_EXE")")/condabin${PATH:+":${PATH}"}"
        fi
        export PATH

        # We're not allowing PS1 to be unbound. It must at least be set.
        # However, we're not exporting it, which can cause problems when starting a second shell
        # via a first shell (i.e. starting zsh from bash).
        if [ -z "${PS1+x}" ]; then
            PS1=
        fi
    fi
    # <<< conda initialize <<<

    # for gstreamer
    export PATH="/usr/local/opt/icu4c/bin:$PATH"
    export PATH="/usr/local/opt/icu4c/sbin:$PATH"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/icu4c/lib/pkgconfig"
    export LDFLAGS="$LDFLAGS -L/usr/local/opt/icu4c/lib"
    export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/icu4c/include"

    # for guile (a gstreamer good plugin)
    export GUILE_LOAD_PATH="/usr/local/share/guile/site/3.0"
    export GUILE_LOAD_COMPILED_PATH="/usr/local/lib/guile/3.0/site-ccache"
    export GUILE_SYSTEM_EXTENSIONS_PATH="/usr/local/lib/guile/3.0/extensions"

    # for gnutls (a gstreamer good plugin)
    export GUILE_TLS_CERTIFICATE_DIRECTORY=/usr/local/etc/gnutls/

    # for mpv
    export PATH="/usr/local/opt/libarchive/bin:$PATH"
    export LDFLAGS="$LDFLAGS -L/usr/local/opt/libarchive/lib"
    export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/libarchive/include"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libarchive/lib/pkgconfig"
    export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
    export XML_CATALOG_FILES="/usr/local/etc/xml/catalog"

    # for data version control (dvc)
    export LDFLAGS="$LDFLAGS -L/usr/local/opt/openblas/lib"
    export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/openblas/include"

    # for dpkg CLI
    PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH"

    # temporarily, until gcloud issue: https://issuetracker.google.com/issues/170125513 is resolved
    export CLOUDSDK_PYTHON=python3.8

    # disable .NET telemetry
    export DOTNET_CLI_TELEMETRY_OPTOUT='true'

    # lazy way to open neovim
    alias v="nvim"
    alias vi="nvim"
    alias vim="nvim"

    # add Firefox to PATH
    export PATH="/Applications/Firefox Developer Edition.app/Contents/MacOS:$PATH"

    # make pyenv and brew play nice
    alias brew='env PATH="${PATH//:($(pyenv root)\/shims|$HOME\/.platformio\/penv\/bin)/}" brew'

    # lazy way to clear the console
    alias c="clear"

    # lazy way to clear the console
    alias e="exit"

    # lazy way to manage the empty-trash-cli and trash-cli
    alias t="trash"
    alias et="empty-trash"

    # easily copy current working directory
    alias copydir="pwd | pbcopy"

    # activate powerlevel10k
    source /usr/local/opt/powerlevel10k/powerlevel10k.zsh-theme

    # To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
    [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh

    # alternative alias to activate fasd's vim shortcut
    export EDITOR="nvim"
    alias vv="f -e '$EDITOR'"

    # follow tcl-tk's caveats
    export PATH="/usr/local/opt/tcl-tk/bin:$PATH"
    export LDFLAGS="$LDFLAGS -L/usr/local/opt/tcl-tk/lib"
    export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/tcl-tk/include"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/tcl-tk/lib/pkgconfig"

    # link zlib to fix pyenv installations failing
    export LDFLAGS="$LDFLAGS -L/usr/local/opt/zlib/lib"
    export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/zlib/include"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH /usr/local/opt/zlib/lib/pkgconfig"

    # brew package prefixes (hardcoded for speedups)
    export OPENSSL_PREFIX="/usr/local/opt/openssl@3"
    export ZLIB_PREFIX="/usr/local/opt/zlib"
    export SQLITE_PREFIX="/usr/local/opt/sqlite"
    export READLINE_PREFIX="/usr/local/opt/readline"

    # pyenv fixes from https://github.com/pyenv/pyenv/issues/1643#issuecomment-745270388
    export PYTHON_CONFIGURE_OPTS="--with-openssl=$OPENSSL_PREFIX"

    export LDFLAGS="$LDFLAGS -L$(xcrun --show-sdk-path)/usr/lib"

    export LDFLAGS="$LDFLAGS -L$ZLIB_PREFIX/lib"
    export CPPFLAGS="$CPPFLAGS -I$ZLIB_PREFIX/include"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH $ZLIB_PREFIX/pkgconfig"

    export LDFLAGS="$LDFLAGS -L$SQLITE_PREFIX/lib"
    export CPPFLAGS="$CPPFLAGS -I$SQLITE_PREFIX/include"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH $SQLITE_PREFIX/lib/pkgconfig"

    export LDFLAGS="$LDFLAGS -L$OPENSSL_PREFIX/lib"
    export CPPFLAGS="$CPPFLAGS -I$OPENSSL_PREFIX/include"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH $OPENSSL_PREFIX/lib/pkgconfig"

    export LDFLAGS="$LDFLAGS -L$READLINE_PREFIX/lib"
    export CPPFLAGS="$CPPFLAGS -I$READLINE_PREFIX/include"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH $READLINE_PREFIX/lib/pkgconfig"

    # set up environment variables for Android Studio
    export ANDROID_SDK=/Users/matt/Library/Android/sdk
    export PATH=/Users/matt/Library/Android/sdk/platform-tools:$PATH

    # Add Gem.user_dir so that gem executables will run
    # (note: instead of using `ruby` to get gem user_dir, we hardcode it for speedups)
    export PATH="/Users/matt/.gem/ruby/3.0.0/bin:$PATH"

    # Add pss function to paste a screenshot from clipboard
    function pss () {
        folder=$(pwd)
        filename="Screen Shot $(date +%Y-%m-%d\ at\ %H.%M.%S).png"

        if [ $# -ne 0 ]; then
            if [[ -d $1 ]]; then
                if [ "$1" != "." ]; then folder=$1; fi
            else
                a=$(dirname "$1")
                b=$(basename "$1" .png)

                if [ "$b" != "" ]; then filename=$b.png; fi

                if [ "$a" != "." ]; then folder=$a; fi
            fi
        fi

        osascript -e "tell application \"System Events\" to ¬
                write (the clipboard as «class PNGf») to ¬
                (make new file at folder \"$folder\" ¬
                with properties {name:\"$filename\"})"
    }

    # add googletest to C++ flags
    export LDFLAGS="$LDFLAGS -L/usr/local/opt/googletest/lib"
    export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/googletest/include"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/googletest/lib/pkgconfig"

    # add binutils to PATH and C++ flags
    export PATH="/usr/local/opt/binutils/bin:$PATH"
    export LDFLAGS="$LDFLAGS -L/usr/local/opt/binutils/lib"
    export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/binutils/include"

    # fix Mono assemblies
    export MONO_GAC_PREFIX="/usr/local"

    # add [email protected] to C++ flags and last in PATH
    export LDFLAGS="$LDFLAGS -L/usr/local/opt/[email protected]/lib"
    export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/[email protected]/lib/pkgconfig"
    export PATH="$PATH:/usr/local/opt/[email protected]/bin"

    # add LLVM to PATH and C++ flags
    export LDFLAGS="$LDFLAGS -L/usr/local/opt/llvm/lib"
    export CPPFLAGS="$CPPFLAGS -I/usr/local/opt/llvm/include"
    export PATH="/usr/local/opt/llvm/bin:$PATH"
    LDFLAGS="$LDFLAGS -L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"

    unalias o

    function o {
        if [ $# -eq 0 ]
            then
                open .
            else
                fasd -a -e open $1
        fi
    }

    # specify Java to be liberica jdk 16 full
    export JAVA_HOME=`/usr/libexec/java_home -v 17`

    # sudo with fingerprint
    sudo() {
        unset -f sudo
        if [[ "$(uname)" == 'Darwin' ]] && ! grep 'pam_tid.so' /etc/pam.d/sudo --silent; then
        sudo sed -i -e '1s;^;auth       sufficient     pam_tid.so\n;' /etc/pam.d/sudo
        fi
        sudo "$@"
    }

    # antigen
    source $BREW_PREFIX/share/antigen/antigen.zsh

    # base antigen on omz
    antigen use oh-my-zsh

    # install antigen bundles
    antigen bundle deno
    antigen bundle zsh-users/zsh-syntax-highlighting
    antigen bundle zsh-users/zsh-autosuggestions

    # apply bundles
    antigen apply

    # git mergetool
    alias gmt="git mergetool"

    # use GNU make (for parallel building)
    PATH="/usr/local/opt/make/libexec/gnubin:$PATH"

    # gcloud
    source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc
    source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc

    # fix pyenv's python-build
    export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk
    export MACOSX_DEPLOYMENT_TARGET=12.3
    export PATH="/usr/local/opt/util-linux/bin:$PATH"
    export PATH="/usr/local/opt/util-linux/sbin:$PATH"

    # lazy load nvm and rvm
    lazy_load() {
        # Act as a stub to another shell function/command. When first run, it will load the actual function/command then execute it.
        # E.g. This made my zsh load 0.8 seconds faster by loading `nvm` when "nvm", "npm" or "node" is used for the first time
        # $1: space separated list of alias to release after the first load
        # $2: file to source
        # $3: name of the command to run after it's loaded
        # $4+: argv to be passed to $3
        echo "Lazy loading $1 ..."

        # $1.split(' ') using the s flag. In bash, this can be simply ($1) #http://unix.stackexchange.com/questions/28854/list-elements-with-spaces-in-zsh
        # Single line won't work: local names=("${(@s: :)${1}}"). Due to http://stackoverflow.com/questions/14917501/local-arrays-in-zsh   (zsh 5.0.8 (x86_64-apple-darwin15.0))
        local -a names
        if [[ -n "$ZSH_VERSION" ]]; then
            names=("${(@s: :)${1}}")
        else
            names=($1)
        fi
        unalias "${names[@]}"
        eval "$2"
        shift 2
        $*
    }

    group_lazy_load() {
        local script
        script=$1
        shift 1
        for cmd in "$@"; do
            alias $cmd="lazy_load \"$*\" \"$script\" $cmd"
        done
    }

    export NVM_DIR=~/.nvm
    group_lazy_load ". $HOME/.nvm/nvm.sh" nvm node npm

    export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
    group_lazy_load ". $HOME/.rvm/scripts/rvm" rvm irb rake

    # virutalenvwrapper set up
    export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true"
    export WORKON_HOME=$HOME/.virtualenvs
    group_lazy_load "pyenv virtualenvwrapper_lazy" virtualenvwrapper wipeenv cdproject setvirtualenvproject mkproject toggleglobalsitepackages add2virtualenv lssitepackages cdsitepackages cdvirtualenv deactivate workon allvirtualenv cpvirtualenv rmvirtualenv showvirtualenv lsvirtualenv mktmpenv mkvirtualenv

    unset -f group_lazy_load

    # update node to latest lts version
    function nvm::update() {
        local -r current_node_version=$(nvm current)
        local -r next_node_version=$(nvm version-remote --lts)
        if [ "$current_node_version" = "system" ]; then
            echo "You're on the system version of node! Switch to an nvm-installed version to update it."
        elif [ "$current_node_version" = "$next_node_version" ]; then
            echo "You're already on the latest version!"
        else
            local -r previous_node_version=$current_node_version
            nvm install --lts
            nvm reinstall-packages "$previous_node_version"
            nvm uninstall "$previous_node_version"
            nvm cache clear
        fi
    }

    # set pnpm home
    export PNPM_HOME="/Users/matt/Library/pnpm"
    export PATH="$PNPM_HOME:$PATH"

    # add go to PATH
    export PATH="/usr/local/opt/[email protected]/bin:$PATH"

    # add rvm to first place in PATH
    export PATH="$HOME/.rvm/gems/ruby-3.0.0/bin:$PATH"
fi

timings.txtGoogle Drive 链接(文件过大)

编辑:

这是timings.txt它在约 0.4 秒内启动时的情况:Google Drive 链接。请注意,它似乎很少引用compdumpcompinit

相关内容