Switch from zplug to zinit for ZSH plugins

Zinit allows near instant shell startup by loading plugins in the
background after initializing the shell. This has yielded a 60-70ms
startup time instead of around 360ms as it was with zplug.

And even if you disable the background loading, zinit itself is still
faster at around 130ms.
This commit is contained in:
2020-05-03 20:06:38 +01:00
parent d9ecb49703
commit d781d3d48e
3 changed files with 34 additions and 39 deletions

3
.gitmodules vendored
View File

@@ -13,3 +13,6 @@
[submodule "zsh/zplug/zplug"] [submodule "zsh/zplug/zplug"]
path = zsh/zplug/zplug path = zsh/zplug/zplug
url = https://github.com/zplug/zplug url = https://github.com/zplug/zplug
[submodule "zsh/zinit"]
path = zsh/zinit
url = https://github.com/zdharma/zinit.git

1
zsh/zinit Submodule

Submodule zsh/zinit added at ff12246fb4

69
zshrc
View File

@@ -11,43 +11,45 @@ fi
# ============================================================================== # ==============================================================================
# zplug # Zinit
# ============================================================================== # ==============================================================================
ZPLUG_HOME="$DOTZSH/zplug/zplug" declare -A ZINIT
ZPLUG_CACHE_DIR="$HOME/.local/zsh/zplug/cache" ZINIT[BIN_DIR]="$DOTZSH/zinit"
ZPLUG_REPOS="$HOME/.local/zsh/zplug/repos" ZINIT[HOME_DIR]="$HOME/.local/zsh/zinit"
source "$ZPLUG_HOME/init.zsh" source "${ZINIT[BIN_DIR]}/zinit.zsh"
alias zp="zplug"
zplug "lib/history", from:oh-my-zsh, defer:1 # Enable using oh-my-zsh compatible themes.
zplug "lib/completion", from:oh-my-zsh, defer:1 zinit snippet OMZ::lib/theme-and-appearance.zsh
zplug "jimeh/zsh-peco-history", defer:2 zinit snippet OMZ::lib/git.zsh
zplug "plugins/bundler", from:oh-my-zsh zinit snippet OMZ::plugins/git
zplug "plugins/git", from:oh-my-zsh zinit cdclear -q # forget completions provided up to this point
zplug "zsh-users/zsh-completions"
zplug "zsh-users/zsh-autosuggestions"
zplug "zsh-users/zsh-syntax-highlighting", defer:3
zplug "jimeh/plain.zsh-theme", as:theme # Enable interactive selection of completions.
zinit snippet OMZ::lib/completion.zsh
# Install plugins if there are plugins that have not been installed # Set various sane defaults for ZSH history management.
if ! zplug check --verbose; then zinit snippet OMZ::lib/history.zsh
printf "Install? [y/N]: "
if read -q; then
echo
zplug install
fi
fi
# Configure zsh-syntax-highlighting # Enable Ruby Bundler plugin from oh-my-zsh.
if zplug check zsh-users/zsh-syntax-highlighting; then zinit snippet OMZ::plugins/bundler
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
fi
zplug load zinit ice pick'plain.zsh-theme'
zinit light jimeh/plain.zsh-theme
zinit ice wait'0' lucid
zinit load jimeh/zsh-peco-history
zinit ice wait'0' lucid blockf
zinit light zsh-users/zsh-completions
zinit ice wait'0' lucid atload"!_zsh_autosuggest_start"
zinit light zsh-users/zsh-autosuggestions
ZSH_HIGHLIGHT_HIGHLIGHTERS=(main brackets)
zinit ice wait'0' lucid atinit"ZINIT[COMPINIT_OPTS]=-C; zicompinit; zicdreplay"
zinit light zdharma/fast-syntax-highlighting
# ============================================================================== # ==============================================================================
# Private Dotfiles # Private Dotfiles
@@ -58,17 +60,6 @@ if [ -f "$DOTPFILES/zshrc" ]; then
fi fi
# ==============================================================================
# Completion
# ==============================================================================
# Enable bash-style completion.
autoload -Uz +X compinit && compinit
autoload -Uz +X bashcompinit && bashcompinit
fpath=("$DOTZSH/completion" "${fpath[@]}")
# ============================================================================== # ==============================================================================
# Tool specific setup # Tool specific setup
# ============================================================================== # ==============================================================================