Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: make vi-*-word widgets respect WORDCHARS



Hi Oliver

On Tue, 10 Jan 2023 18:06:58 +0100
Oliver Kiddle <opk@xxxxxxx> wrote:

> On 31 Dec, ml_zsh-workers@xxxxxxxxxxxxxxxxx wrote:
> > The vi-backward-kill-word widget does not seem to respect WORDCHARS:  
> > Is this a bug or intended?  
> 
> It is intended. vi-backward-kill-word works in a vi compatible manner

Thank you. I found out that WORDCHARS actually comes from emacs. I thought it was zsh-specific. So it makes sense that these behave differently.

> No. But you can just bind Ctrl-W to backward-kill-word:
> 
>   bindkey '^W' backward-kill-word

I did that and a few other adjustments to the keybindings now to get the behaviour I want:
```
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
# these characters do _not_ separate words but are part of words
zstyle ':zle:*' word-chars '*?[]~;!#$%^(){}<>'
```

Now it seems to behave like I want it to.

Cheers

henk

Attachment: pgpABOYVivZYF.pgp
Description: OpenPGP digital signature



Messages sorted by: Reverse Date, Date, Thread, Author