changeset 542:89769aa79628

add zsh-vi-mode plugin
author zegervdv <zegervdv@me.com>
date Sat, 29 Jan 2022 22:12:33 +0100
parents 80622cb35a3e
children 15d6c097f1c9
files .chezmoiexternal.toml dot_zshrc
diffstat 2 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/.chezmoiexternal.toml	Fri Jan 28 16:36:32 2022 +0100
+++ b/.chezmoiexternal.toml	Sat Jan 29 22:12:33 2022 +0100
@@ -53,6 +53,11 @@
   url = "https://github.com/m42e/zsh-histdb-fzf/raw/master/fzf-histdb.zsh"
   refreshPeriod = "168h"
 
+[".zsh/zsh-vi-mode.zsh"]
+  type = "file"
+  url = "https://github.com/jeffreytse/zsh-vi-mode/raw/master/zsh-vi-mode.zsh"
+  refreshPeriod = "168h"
+
 [".zsh/completions/_fd"]
   type = "file"
   url = "https://github.com/sharkdp/fd/raw/master/contrib/completion/_fd"
--- a/dot_zshrc	Fri Jan 28 16:36:32 2022 +0100
+++ b/dot_zshrc	Sat Jan 29 22:12:33 2022 +0100
@@ -68,15 +68,6 @@
 
 bindkey -v
 
-bindkey '^[[A' history-substring-search-up
-bindkey '^[[B' history-substring-search-down
-bindkey "$terminfo[kcuu1]" history-substring-search-up
-bindkey "$terminfo[kcud1]" history-substring-search-down
-bindkey '^p' history-substring-search-up
-bindkey '^n' history-substring-search-down
-
-bindkey '^f' autosuggest-accept
-
 zmodload zsh/complist
 bindkey -M menuselect 'h' vi-backward-char
 bindkey -M menuselect 'k' vi-up-line-or-history
@@ -232,9 +223,6 @@
 export RIPGREP_CONFIG_PATH=$HOME/.config/ripgrep/ripgreprc
 export BAT_CONFIG_PATH=$HOME/.config/bat/config
 
-[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
-
-bindkey '^t' push-line-or-edit
 
 [ -f ~/.zshrc.local ] && source ~/.zshrc.local
 
@@ -252,7 +240,23 @@
 source ~/.zsh/zsh-histdb/sqlite-history.zsh
 source ~/.zsh/fzf-histdb.zsh
 
-bindkey '^r' histdb-fzf-widget
+# The plugin will auto execute this zvm_after_init function
+function zvm_after_init() {
+  [ -f ~/.fzf.zsh  ] && source ~/.fzf.zsh
+  bindkey '^r' histdb-fzf-widget
+  bindkey '^t' push-line-or-edit
+
+  bindkey '^[[A' history-substring-search-up
+  bindkey '^[[B' history-substring-search-down
+  bindkey "$terminfo[kcuu1]" history-substring-search-up
+  bindkey "$terminfo[kcud1]" history-substring-search-down
+  bindkey '^p' history-substring-search-up
+  bindkey '^n' history-substring-search-down
+
+  bindkey '^f' autosuggest-accept
+}
+
+source ~/.zsh/zsh-vi-mode.zsh
 
 _zsh_autosuggest_strategy_histdb_top_here() {
     local query="select commands.argv from