changeset 658:77f3f615e4bf

Add zsh-defer to load zsh prompt faster (I think?)
author zegervdv <zegervdv@me.com>
date Sat, 24 Sep 2022 16:02:02 +0000
parents 3b903fda0c14
children e1a7072165ac
files .chezmoiexternal.toml dot_zshrc
diffstat 2 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/.chezmoiexternal.toml	Sat Sep 24 15:44:37 2022 +0000
+++ b/.chezmoiexternal.toml	Sat Sep 24 16:02:02 2022 +0000
@@ -49,6 +49,10 @@
   type = "file"
   url = "https://github.com/m42e/zsh-histdb-skim/raw/v0.7.6/zsh-histdb-skim.zsh"
 
+[".zsh/zsh-defer.zsh"]
+  type = "file"
+  url = "https://github.com/romkatv/zsh-defer/raw/3770c54fb4b25a1256dfaabbde37c4399c1f9298/zsh-defer.plugin.zsh"
+
 [".zsh/completions/_fd"]
   type = "file"
   url = "https://github.com/sharkdp/fd/raw/v8.3.2/contrib/completion/_fd"
--- a/dot_zshrc	Sat Sep 24 15:44:37 2022 +0000
+++ b/dot_zshrc	Sat Sep 24 16:02:02 2022 +0000
@@ -1,5 +1,7 @@
 # vim:ft=zsh
 
+source ~/.zsh/zsh-defer.zsh
+
 fpath=(~/.zsh/completions $fpath)
 
 export TERM=xterm-256color
@@ -54,7 +56,7 @@
 
 precmd () { vcs_info }
 
-RPROMPT='${vcs_info_msg_0_} ${vim_mode}'
+zsh-defer -c 'RPROMPT="\${vcs_info_msg_0_} \${vim_mode}"'
 
 zmodload -i zsh/complist
 
@@ -238,18 +240,18 @@
 export SUDO_EDITOR=$(which nvim)
 eval "$(direnv hook zsh)"
 
-source ~/.zsh/zsh-history-substring-search.zsh
+zsh-defer source ~/.zsh/zsh-history-substring-search.zsh
 export HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND='bg=cyan,fg=white'
 
-source ~/.zsh/zsh-autosuggestions.zsh
+zsh-defer source ~/.zsh/zsh-autosuggestions.zsh
 
-source ~/.zsh/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
+zsh-defer source ~/.zsh/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh
 
 export HISTDB_FILE="${HOME}/.histdb/zsh-history-$(hostname).db"
-source ~/.zsh/zsh-histdb/sqlite-history.zsh
-source ~/.zsh/zsh-histdb-skim/zsh-histdb-skim.zsh
+zsh-defer source ~/.zsh/zsh-histdb/sqlite-history.zsh
+zsh-defer source ~/.zsh/zsh-histdb-skim/zsh-histdb-skim.zsh
 
-source ~/.zsh/jq-zsh-plugin/jq.plugin.zsh
+zsh-defer source ~/.zsh/jq-zsh-plugin/jq.plugin.zsh
 
 # The plugin will auto execute this zvm_after_init function
 function zvm_after_init() {
@@ -272,7 +274,7 @@
   bindkey '^f' autosuggest-accept
 }
 
-source ~/.zsh/zsh-vi-mode.zsh
+zsh-defer source ~/.zsh/zsh-vi-mode.zsh
 
 _zsh_autosuggest_strategy_histdb_top_here() {
     local query="select commands.argv from