On Sun, Mar 24, 2013 at 06:43:47PM +0100, glts wrote:

> On Sun, Mar 24, 2013 at 12:40 AM, Sung Pae <[email protected]> wrote:
> > I see two issues on first glance:
> >
> >     * Counts are not repeated; d2x (x being a custom motion) repeats as
> >       dx only
>
> Yes, but this is due to another bug. My patch does not affect this.
>
> The v:count variables are treated differently in omaps. Compare:

Ah yes, you're totally correct. I remember now that I had to work
around that myself by saving v:count to a buffer-local variable on omap
invocation, then string-replace the v:count variable in the omap rhs
with the buffer-local "b:_count", so that the cached value would be used
on repeat. It was very nasty, but it worked.

> This is a different issue, and I'd rather put it off for the moment.

Yes, I imagine a new count variable needs to be created to handle omaps.

> >     * Making a visual selection with a custom operator clobbers the redo
>
> Can you give an example? I don't see the problem.

I apologize, that was a bit vague.

Let's create a simple (and incomplete) custom motion:

    function! SelectInCaps()
        let [bl, bc] = searchpos('\u', 'cbW')
        let [el, ec] = searchpos('.\u\ze', 'W')
        call setpos("'<", [0, bl, bc, 0])
        call setpos("'>", [0, el, ec, 0])
        normal! gv
    endfunction

Then map it to both visual and operator-pending modes:

    vmap ic :<C-U>call SelectInCaps()<CR>
    omap ic :<C-U>call SelectInCaps()<CR>

Repeating the command dic with the . command works now with your patch:

    Foo|BarBazQuux
    Foo|BazQuux     " dic
    Foo|Quuz        " .

However, if we invoke vic after running dic, the . command no longer has
any affect:

    Foo|BarBazQuux
    Foo|BazQuux     " dic
    Foo|BazQuux     " vic<Esc>
    Foo|BazQuux     " .

This is not true of the builtin motions like `aw`; visual commands do
not clobber the repeat buffer (or however it may work).

Thank you for your work on this!

    Sung Pae

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui