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

Re: New widget "transpose-segments"



On 9 January 2016 at 18:22, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Jan 9, 12:03pm, Sebastian Gniazdowski wrote:
> } Subject: New widget "transpose-segments"
> }
> } I've attached a new widget "transpose-segments". Works like
> } "transpose-words", but the "words" are what I call "segments"
>
> How does this differ from
>
>     autoload select-word-style
>     select-word-style shell
>     zle -N transpose-words transpose-words-match
>
> ??

I now tested:

autoload select-word-style
select-word-style shell
autoload transpose-words-match
zle -N transpose-words-match
bindkey "^[t" transpose-words-match

The main difference is working across newlines. Also, the requirement
to position cursor at beginning of word to transpose is absent. I
think those two are important. Also, setting word style is not needed.
I have to admit that my functionality isn't new and practically exists
in Zsh already, however, why not have alternative approach available,
with freedom of where to position cursor and with support for
newlines. And with freedom for word style.

BTW. I asked about transpose-words on IRC and here, and then nobody
told me about set-word-style shell. That's maybe not bad if the
alternative (z)-based approach will be recognized as valuable.

Best regards,
Sebastian Gniazdowski



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