Hi Daniel!

On Di, 19 Nov 2013, Daniel paradigm Thau wrote:

> I noticed a common pattern when using Vim:
> - I want to operate on a text object that is not under/around the cursor
> - The cursor is not over/in a text object of this type.
> 
> For example, with the cursor on the "x" and a desire to operate on the 
> conditional part of the if-statement:
> 
>     x = 1;
>     ...
>     if (...) {
>         ...
>     }
> 
> In these situations I have been moving the cursor to the object then 
> selecting the object with something like "/(<cr>vi(" or "5jf(vi(".
> 
> However, in that situation the text-object commands don't do anything.  We 
> could have Vim do something useful in this context - jump to the desired text 
> object.  If the given text-object command is valid - if the cursor is already 
> in a ()-block - then what Vim normally does should happen.  However, if Vim 
> is about to "return FAIL" could simply search the buffer for the object and, 
> if it finds it, use that object instead.
> 
> Moreover, block text-objects (parens, {}, [], <>) have two (or three!) ways 
> to access them.  This could be used to indicate direction.  "vi(" will select 
> the ()-block under/around the cursor or, if no such block exists in that 
> area, searches forward for a ()-block.  "vi)" will do the same except it will 
> search in reverse.  "vib" will just act as it always has.  Similar actions 
> will be used on {}, [], and <>.
> 

I think it should be ( to move to the previous object and ) to move to 
the next block. This would match the behaviour of [s ]s and [z and ]z 
and other similar motions.

Other then that, this sounds like a useful addition (although some 
scripts might depend on the current behaviour).

regards,
Christian
-- 
"Sie brauchen den Mund nicht so weit aufmachen", sagte der Zahnarzt
"Wollen Sie denn nicht bohren?"
"Doch, schon, ... aber ich bleibe draußen."

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