Imrpove zsh startup performance

This commit is contained in:
2026-04-22 05:21:23 +02:00
parent 3f586c4d0d
commit 273f74a67a
6 changed files with 76 additions and 6 deletions
+19 -6
View File
@@ -1,3 +1,4 @@
# vim: set ft=zsh:
# Path to your oh-my-zsh installation.
export DOTFILES=${DOTFILES:-"$HOME/.dotfiles"}
export ZSH="$DOTFILES/zsh/ohmyzsh"
@@ -5,8 +6,18 @@ export ZSH_CUSTOM="$DOTFILES/zsh/custom"
ZSH_THEME="agnoster_dx"
zstyle ':omz:update' mode reminder # just remind me to update when it's time
# zstyle ':omz:update' frequency 13
zstyle -s ':omz:update' mode "disabled"
# Fix slow pasting due to zsh-autosuggestions
pasteinit() {
OLD_SELF_INSERT=${${(s.:.)widgets[self-insert]}[2,3]}
zle -N self-insert url-quote-magic # I wonder if you'd need `.url-quote-magic`?
}
pastefinish() {
zle -N self-insert $OLD_SELF_INSERT
}
zstyle :bracketed-paste-magic paste-init pasteinit
zstyle :bracketed-paste-magic paste-finish pastefinish
# CASE_SENSITIVE="true"
# HYPHEN_INSENSITIVE="true"
@@ -18,6 +29,8 @@ ZSH_DISABLE_COMPFIX="true"
ZOXIDE_CMD_OVERRIDE="cd"
plugins=(
evalcache
zsh-defer
git
zsh-autosuggestions
# Disabled because the highlighting conflicts with autosuggestions
@@ -26,7 +39,7 @@ plugins=(
colored-man-pages
command-not-found
zsh-autopair
fast-syntax-highlighting
# fast-syntax-highlighting
zoxide
mise
gpg-agent
@@ -64,7 +77,6 @@ KEYTIMEOUT=1
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/completions
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
autoload -Uz compinit && compinit
source "$ZSH/oh-my-zsh.sh"
less_termcap[so]="${fg_bold[black]}${bg[white]}"
@@ -118,7 +130,8 @@ else
unset PNPM_HOME
fi
if (( $+commands[pnpm] )); then
source <(pnpm completion zsh)
# Without evalcache it more than doubles startup time
_evalcache pnpm completion zsh
fi
export FZF_DEFAULT_OPTS='--tmux'
@@ -139,7 +152,7 @@ fi
if (( $+commands[fzf] )); then
# Fix fzf keybind after zsh-vi-mode has loaded
zvm_after_init_commands+=('source <(fzf --zsh)')
zvm_after_init_commands+=('_evalcache fzf --zsh')
if (( $+commands[paru] )); then
function pi {