From 9bf149bcfa8a2b41739c9064a461a2f22781e548 Mon Sep 17 00:00:00 2001 From: Hendrik Jäger Date: Tue, 10 Jan 2023 23:02:44 +0100 Subject: fix: better keybindings and word selection --- .zshrc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index f6d1c55..82279d4 100644 --- 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' -- cgit v1.2.3