]> git.netwichtig.de Git - user/henk/vcsh/zsh.git/commitdiff
fix: better keybindings and word selection
authorHendrik Jäger <gitcommit@henk.geekmail.org>
Tue, 10 Jan 2023 22:02:44 +0000 (23:02 +0100)
committerHendrik Jäger <gitcommit@henk.geekmail.org>
Tue, 10 Jan 2023 22:02:44 +0000 (23:02 +0100)
.zshrc

diff --git a/.zshrc b/.zshrc
index f6d1c55c83a7284b4bda404421451dfeea046607..82279d4dcaa1a1ae9c69510799a0789ee3c652f9 100644 (file)
--- a/.zshrc
+++ b/.zshrc
@@ -15,7 +15,9 @@ REPORTTIME=10
 
 ## define word characters (for stuff like backward-word, forward-word, backward-kill-word,..)
 ## these are NOT separators but chars considered part of a word
-#WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
+## these are NOT respected by e.g. vi-backward-kill-word, it seems
+# WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
+## see below how to solve this with select-word-style module
 
 
 # where zsh looks for functions
@@ -176,6 +178,19 @@ done
 # keybindings might have been changed by plugins, etc.
 # so they go more to the bottom
 
+# the vi bindings for these do not respect WORDCHARS and are not replaced by the select-word-style functions
+bindkey -M vicmd 'w' forward-word
+bindkey -M vicmd 'b' backward-word
+bindkey -M viins '^W' backward-kill-word
+
+
+# better word matching
+autoload -U select-word-style
+select-word-style normal
+zstyle ':zle:*' word-style normal
+# these characters do _not_ separate words but are part of words
+zstyle ':zle:*' word-chars '*?[]~;!#$%^(){}<>'
+
 
 # should probably be closer to the bottom than the top?
 zgenom load 'https://github.com/nojhan/liquidprompt'