On Mon, Mar 25, 2013 at 2:08 AM, Sung Pae <[email protected]> wrote:
> 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     " .

Yes, sorry, and thanks for reporting. Operator and Visual mode handling
isn't easy and I'm learning it the hard way ...

Anyway, after another session in the debugger I came up with the slight
amendment in the attachment. If you would like to try it, be my guest. I
hope I can find the time to write a few tests.

David

-- 
-- 
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.


Attachment: operator-plus-normal-visual.patch
Description: Binary data

Raspunde prin e-mail lui