Trying some tweaks with zshrc, still takes 600ms+ to complete

This commit is contained in:
2024-11-02 01:37:54 +02:00
parent 8faced2c05
commit facf8d870d

76
.zshrc
View File

@@ -1,3 +1,5 @@
START_TIME=$(date +%s.%3N)
# Fix for tmux on openSuse with WSL2
mkdir -p /tmp
export TMUX_TMPDIR='/tmp'
@@ -24,30 +26,46 @@ autoload -Uz _zinit
zinit ice wait lucid && zinit light zsh-users/zsh-syntax-highlighting
zinit ice wait lucid && zinit light zsh-users/zsh-completions
zinit ice wait lucid && zinit light Aloxaf/fzf-tab
zinit ice wait lucid atload'_zsh_autosuggest_start'
zinit light zsh-users/zsh-autosuggestions
# zinit ice atload'_zsh_autosuggest_start' && zinit light zsh-users/zsh-autosuggestions # WARNING: EXPENSIVE
zinit ice depth=1 wait lucid && zinit light jeffreytse/zsh-vi-mode
# Zsh snippets
# # Zsh snippets
zinit ice wait lucid && zinit snippet OMZP::git
zinit ice wait lucid && zinit snippet OMZP::sudo
zinit ice wait lucid && zinit snippet OMZP::kubectl
zinit ice wait lucid && zinit snippet OMZP::kubectx
zinit ice wait lucid && zinit snippet OMZP::command-not-found
# Fat cursor
function zle-line-init {
echo -ne '\e[2 q'
}
zle -N zle-line-init
# Completion styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls $realpath'
# Keybindings
bindkey -v
# Load oh my posh
eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/tokyocat.omp.yml)"
# zinit ice wait atload"eval '$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/tokyocat.omp.yml)'"
# zinit load zdharma-continuum/null
# # Shell integrations
zinit ice wait lucid atload"source <(fzf --zsh)"
zinit load zdharma-continuum/null
zinit ice wait lucid atload'eval "$(zoxide init --cmd cd zsh)"'
zinit load zdharma-continuum/null
# # Fat cursor
# function zle-line-init {
# echo -ne '\e[2 q'
# }
# zle -N zle-line-init
# # Keybindings
# bindkey -v
bindkey '^y' autosuggest-accept
bindkey '^p' history-search-backward
bindkey '^n' history-search-forward
bindkey '^[w' kill-region
# bindkey '^[w' kill-region
# History
# # History
HISTSIZE=5000
HISTFILE=~/.zsh_history
SAVEHIST=$HISTSIZE
@@ -60,22 +78,6 @@ setopt hist_save_no_dups
setopt hist_ignore_dups
setopt hist_find_no_dups
# Completion styling
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
zstyle ':completion:*' menu no
zstyle ':fzf-tab:complete:cd:*' fzf-preview 'ls $realpath'
zstyle ':fzf-tab:complete:__zoxide_z:*' fzf-preview 'ls $realpath'
# Load oh my posh
eval "$(oh-my-posh init zsh --config $HOME/.config/ohmyposh/tokyocat.omp.yml)"
# Shell integrations
zinit ice wait lucid atload"source <(fzf --zsh)"
zinit load zdharma-continuum/null
zinit ice wait lucid atload'eval "$(zoxide init --cmd cd zsh)"'
zinit load zdharma-continuum/null
# Aliases
alias nvim='nvim.sh'
alias cat='bat'
@@ -113,15 +115,5 @@ if [ -z "$TMUX" ]; then
tmux a || tmux
fi
# NOTE: if clipboard breaks try this:
# https://superuser.com/questions/1617298/wsl-2-running-ubuntu-x-server-cant-open-display#1618390
# setting display to:
# export DISPLAY=wsl:0.0
# Seems to fix it, but the post says it breaks some stuff (like firefox which I anyways run on windows)
# But just in case, the better way to do it seems to be:
# export DISPLAY=:0
# After more checking, it needs to be the wsl one, otherwise it doesn't work
# After more issues with both, I just disabled systemd again which seems to have issues
# with xclip and tmux and probably more issues I haven't noticed, and all I wanted is to use docker
# I am fine running the docker dameon manually if I need to use docker
END_TIME=$(date +%s.%3N)
# echo "Zsh startup time: $(echo "${END_TIME} - ${START_TIME}" | bc) seconds"