Imrpove zsh startup performance
This commit is contained in:
@@ -19,3 +19,9 @@
|
|||||||
[submodule "zsh/custom/plugins/zsh-vi-mode"]
|
[submodule "zsh/custom/plugins/zsh-vi-mode"]
|
||||||
path = zsh/custom/plugins/zsh-vi-mode
|
path = zsh/custom/plugins/zsh-vi-mode
|
||||||
url = https://github.com/jeffreytse/zsh-vi-mode
|
url = https://github.com/jeffreytse/zsh-vi-mode
|
||||||
|
[submodule "zsh/custom/plugins/evalcache"]
|
||||||
|
path = zsh/custom/plugins/evalcache
|
||||||
|
url = https://github.com/mroth/evalcache/
|
||||||
|
[submodule "zsh/custom/plugins/zsh-defer"]
|
||||||
|
path = zsh/custom/plugins/zsh-defer
|
||||||
|
url = https://github.com/romkatv/zsh-defer
|
||||||
|
|||||||
Submodule
+1
Submodule zsh/custom/plugins/evalcache added at d6973f8c3e
@@ -0,0 +1,32 @@
|
|||||||
|
# mise
|
||||||
|
|
||||||
|
Adds integration with [mise](https://github.com/jdx/mise) (formerly `rtx`), a runtime executor compatible with
|
||||||
|
npm, nodenv, pyenv, etc. mise is written in rust and is very fast. 20x-200x faster than asdf. With that being
|
||||||
|
said, mise is compatible with asdf plugins and .tool-versions files. It can be used as a drop-in replacement.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
1. [Download & install mise](https://github.com/jdx/mise#installation) by running the following:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl https://mise.jdx.dev/install.sh | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
2. [Enable mise](https://github.com/jdx/mise#quickstart) by adding it to your `plugins` definition in
|
||||||
|
`~/.zshrc`.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
plugins=(mise)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
See the [mise readme](https://github.com/jdx/mise#table-of-contents) for information on how to use mise. Here
|
||||||
|
are a few examples:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
mise install node Install the current version specified in .tool-versions/.mise.toml
|
||||||
|
mise use -g node@system Use system node as global default
|
||||||
|
mise install node@20.0.0 Install a specific version number
|
||||||
|
mise use -g node@20 Use node-20.x as global default
|
||||||
|
```
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
if (( ! $+commands[mise] )); then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load mise hooks
|
||||||
|
zsh-defer -a _evalcache mise activate zsh
|
||||||
|
|
||||||
|
# If the completion file doesn't exist yet, we need to autoload it and
|
||||||
|
# bind it to `mise`. Otherwise, compinit will have already done that.
|
||||||
|
if [[ ! -f "$ZSH_CACHE_DIR/completions/_mise" ]]; then
|
||||||
|
typeset -g -A _comps
|
||||||
|
autoload -Uz _mise
|
||||||
|
_comps[mise]=_mise
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Generate and load mise completion
|
||||||
|
mise completion zsh >| "$ZSH_CACHE_DIR/completions/_mise" &|
|
||||||
Submodule
+1
Submodule zsh/custom/plugins/zsh-defer added at 53a26e287f
+19
-6
@@ -1,3 +1,4 @@
|
|||||||
|
# vim: set ft=zsh:
|
||||||
# Path to your oh-my-zsh installation.
|
# Path to your oh-my-zsh installation.
|
||||||
export DOTFILES=${DOTFILES:-"$HOME/.dotfiles"}
|
export DOTFILES=${DOTFILES:-"$HOME/.dotfiles"}
|
||||||
export ZSH="$DOTFILES/zsh/ohmyzsh"
|
export ZSH="$DOTFILES/zsh/ohmyzsh"
|
||||||
@@ -5,8 +6,18 @@ export ZSH_CUSTOM="$DOTFILES/zsh/custom"
|
|||||||
|
|
||||||
ZSH_THEME="agnoster_dx"
|
ZSH_THEME="agnoster_dx"
|
||||||
|
|
||||||
zstyle ':omz:update' mode reminder # just remind me to update when it's time
|
zstyle -s ':omz:update' mode "disabled"
|
||||||
# zstyle ':omz:update' frequency 13
|
|
||||||
|
# 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"
|
# CASE_SENSITIVE="true"
|
||||||
# HYPHEN_INSENSITIVE="true"
|
# HYPHEN_INSENSITIVE="true"
|
||||||
@@ -18,6 +29,8 @@ ZSH_DISABLE_COMPFIX="true"
|
|||||||
ZOXIDE_CMD_OVERRIDE="cd"
|
ZOXIDE_CMD_OVERRIDE="cd"
|
||||||
|
|
||||||
plugins=(
|
plugins=(
|
||||||
|
evalcache
|
||||||
|
zsh-defer
|
||||||
git
|
git
|
||||||
zsh-autosuggestions
|
zsh-autosuggestions
|
||||||
# Disabled because the highlighting conflicts with autosuggestions
|
# Disabled because the highlighting conflicts with autosuggestions
|
||||||
@@ -26,7 +39,7 @@ plugins=(
|
|||||||
colored-man-pages
|
colored-man-pages
|
||||||
command-not-found
|
command-not-found
|
||||||
zsh-autopair
|
zsh-autopair
|
||||||
fast-syntax-highlighting
|
# fast-syntax-highlighting
|
||||||
zoxide
|
zoxide
|
||||||
mise
|
mise
|
||||||
gpg-agent
|
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}/completions
|
||||||
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
|
fpath+=${ZSH_CUSTOM:-${ZSH:-~/.oh-my-zsh}/custom}/plugins/zsh-completions/src
|
||||||
autoload -Uz compinit && compinit
|
|
||||||
source "$ZSH/oh-my-zsh.sh"
|
source "$ZSH/oh-my-zsh.sh"
|
||||||
|
|
||||||
less_termcap[so]="${fg_bold[black]}${bg[white]}"
|
less_termcap[so]="${fg_bold[black]}${bg[white]}"
|
||||||
@@ -118,7 +130,8 @@ else
|
|||||||
unset PNPM_HOME
|
unset PNPM_HOME
|
||||||
fi
|
fi
|
||||||
if (( $+commands[pnpm] )); then
|
if (( $+commands[pnpm] )); then
|
||||||
source <(pnpm completion zsh)
|
# Without evalcache it more than doubles startup time
|
||||||
|
_evalcache pnpm completion zsh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export FZF_DEFAULT_OPTS='--tmux'
|
export FZF_DEFAULT_OPTS='--tmux'
|
||||||
@@ -139,7 +152,7 @@ fi
|
|||||||
|
|
||||||
if (( $+commands[fzf] )); then
|
if (( $+commands[fzf] )); then
|
||||||
# Fix fzf keybind after zsh-vi-mode has loaded
|
# 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
|
if (( $+commands[paru] )); then
|
||||||
function pi {
|
function pi {
|
||||||
|
|||||||
Reference in New Issue
Block a user