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

Re: [vi-mode] widgets for case manipulation: `gU` and `U` in visual mode



Now that 5.0.8 and text objects were mentioned, I think there's a bug with
the `surround` widget. Or maybe just the usage instructions are incorrect.

here are the usage instructions of the `surround` widget on zsh master:

https://github.com/zsh-users/zsh/blob/master/Functions/Zle/surround#L4-L12

# Implementation of some functionality of the popular vim surround plugin.
# Allows "surroundings" to be changes: parentheses, brackets and quotes.

# To use
#   autoload -Uz surround
#   zle -N delete-surround surround
#   zle -N add-surround surround
#   zle -N change-surround surround
#   bindkey -a cs change-surround
#   bindkey -a ds delete-surround
#   bindkey -a ys add-surround
#   bindkey -M visual S add-surround


If I add this to my vi-mode zsh plugin, it does nothing.

for instance, the `ys` chord is not being picked up.

supose i have a word: `abcde` and the cursor is in `c`. if I'm in
normal mode and type `ys` zle thinks that I've hit `s` and deletes the
`c` character and puts me in insert mode.

Maybe it's a bug?


On Wed, Jun 22, 2016 at 10:19 AM, Filipe Silva <filipe.silva@xxxxxxxxx>
wrote:

> Hi Oliver, thanks for sharing the widgets. You should know that there's a
> bug in both widgets in an edge case:
>
> suppose you have the word `abc` and `a` is the first char of the line.
> also suppose you've select just the `ab` of the `abc` word and then hit
> `U`:
>
>
> ```
> # [ab] is the visually selected text
>
> $ [ab]c
> ```
>
> after you hit `U` the result is
>
> ```
> $ cAB
> ```
>
> I've fixed the bug including the following condition:
>
> if [[ $save_cur = '1' ]]; then
>     zle .vi-put-before -n 1
>   else
>     zle .vi-put-after -n 1
>   fi
>
>
>
> On Wed, Jun 22, 2016 at 3:42 AM, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
> wrote:
>
>> On Jun 22,  1:10am, Oliver Kiddle wrote:
>> }
>> } Some of the text objects were done via shell widgets - select-quoted and
>> } select-bracketed which select text between delimiters.
>>
>> Incidentally, I think select-bracketed might break given ksharrays --
>> select-quoted explictly turns ksharrays off.
>>
>
>


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