> Well, I can see that you get the information, but this is not really a
> useful real-world example.  Think of a user that wants to get something
> done for which v:operator is needed.  And for which there is no other
> solution.

Here's a somewhat naively implemented example where a custom text-object is 
defined that allows you to operate on a function name whether the cursor is on 
the 
name itself or on its arguments. You can yank with yF, change with cF, 
uppercase 
with gUF, etc. I can't think of any other way to do this, or more complicated 
language-based custom text-object definition--e.g. yank/change a whole 
conjunction 
or disjunction in a logic language, yank or change the condition of an 'if' or 
'while' loop from anywhere within its body. Some of these would be more useful 
than others, of course, but there are a lot of real world possibilities, I 
think.

Ben.



:onoremap F <Esc>:call OperateFunctionName()<CR>
function! OperateFunctionName()
        let last_count = v:count
        let last_op = v:operator
        let last_reg = v:register
        exe "normal \<Esc>"
        while search('\(\%#\i\|\i\s*\%#\)\i*\s*(','ce',line('.')+1) == 0
                normal [(
        endwhile
        exe "normal \<BS>\"_yiw"
        echo 'normal '.(last_count>0?(last_count):'').'"'.last_reg.last_op.'e'
endfun





Send instant messages to your online friends http://au.messenger.yahoo.com 


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui