zsh-workers
 help / color / mirror / code / Atom feed
* make vi-*-word widgets respect WORDCHARS
@ 2022-12-31 21:04 ml_zsh-workers
  2023-01-10 17:06 ` Oliver Kiddle
  0 siblings, 1 reply; 3+ messages in thread
From: ml_zsh-workers @ 2022-12-31 21:04 UTC (permalink / raw)
  To: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 568 bytes --]

Hi

The vi-backward-kill-word widget does not seem to respect WORDCHARS:
```
frustcomp% zsh -f
frustcomp% bindkey "^W"
"^W" vi-backward-kill-word
frustcomp% mkdir /tmp/foo_bar
frustcomp% ls /tmp/        
frustcomp% WORDCHARS='*?-.[]~=/&;!#$%^(){}<>'
frustcomp% ls /tmp/foo_bar
```
typing ^W at this point will delete 'foo_bar'.
I expect it to only delete 'bar', though, as that is what backward-kill-word does.

Is this a bug or intended?
If intended: is there a different way of adjusting the behaviour of vi-backward-kill-word?

Thank you

henk

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: make vi-*-word widgets respect WORDCHARS
  2022-12-31 21:04 make vi-*-word widgets respect WORDCHARS ml_zsh-workers
@ 2023-01-10 17:06 ` Oliver Kiddle
  2023-01-14 12:31   ` ml_zsh-workers
  0 siblings, 1 reply; 3+ messages in thread
From: Oliver Kiddle @ 2023-01-10 17:06 UTC (permalink / raw)
  To: ml_zsh-workers; +Cc: zsh-workers

On 31 Dec, ml_zsh-workers@henk.geekmail.org 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
both in terms of word endings but also includes refusing to delete past
the cursor position where the current insertion started. Did you want
that behaviour? Vim relaxes that unless configured otherwise.

> If intended: is there a different way of adjusting the behaviour of vi-backward-kill-word?

No. But you can just bind Ctrl-W to backward-kill-word:

  bindkey '^W' backward-kill-word

Oliver


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: make vi-*-word widgets respect WORDCHARS
  2023-01-10 17:06 ` Oliver Kiddle
@ 2023-01-14 12:31   ` ml_zsh-workers
  0 siblings, 0 replies; 3+ messages in thread
From: ml_zsh-workers @ 2023-01-14 12:31 UTC (permalink / raw)
  To: Oliver Kiddle; +Cc: zsh-workers

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

Hi Oliver

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

> On 31 Dec, ml_zsh-workers@henk.geekmail.org 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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-14 12:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-31 21:04 make vi-*-word widgets respect WORDCHARS ml_zsh-workers
2023-01-10 17:06 ` Oliver Kiddle
2023-01-14 12:31   ` ml_zsh-workers

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).