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

Re: Problem with motion commands defined using match-word-by-style used with vi-delete



On 4/22/06, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Apr 22,  1:10am, Nikolai Weibull wrote:
> }
> } [...] $curcontext is set to zle:vi-delete, not, for example,
> } zle:forward-word-match.
> }
> } It seems that this issue can be quite hard to fix, considering how
> } vi-delete is currently implemented.  But perhaps there's an easy
> } solution that I was unable to spot.
>
> Try applying this same small change to each of the *-match functions:
>
> --- 8< ---
> @@ -3,7 +3,7 @@
>
>  autoload match-words-by-style
>
> -local curcontext=":zle:$WIDGET" word
> +local curcontext=":zle:$WIDGETFUNC" word
>  local -a matched_words
>  integer count=${NUMERIC:-1}
>
> --- 8< ---
>
> I didn't actually try that because I'm not a vi mode user and I'm in
> a hurry :-/ but it seems like it should do the trick.  If it doesn't,
> try ${WIDGETFUNC%-match} instead.

Hm, that sets curcontext to :zle:forward-word-match (or
:zle:forward-word), which means it won't be possible to use zstyles
anymore.

The following is what I'm using:

autoload -U forward-word-match
autoload -U backward-word-match
zle -N forward-parameter forward-word-match
zle -N backward-parameter backward-word-match
zstyle ':zle:forward-parameter' word-style shell
zstyle ':zle:backward-parameter' word-style shell
bindkey -a ")" forward-parameter
bindkey -a "(" backward-parameter

> } Until then I'm going to use my own vi-delete
>
> Creating a vi-delete-match function seems like the next best thing.

That's what I meant (I think) :-).

  nikolai



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