Friday, November 4, 2011

Re: Select Outer Block

On 11/04/11 11:39, Paul wrote:
> Say I have some code like this:
>
> sub {
> foo {
>
> bar {
> baz {
> humbug!
> }
> }
> }
> }
>
> and I have the cursor somewhere on the humbug line. If I want
> to select the whole lot, to the very outer block, ie.
> everything from 'sub {' to its closing brace, I can do 'v4a{'.
> However, that requires me knowing how many blocks I'm inside.
> Doing something like 'v9a{' doesn't select anything.
> Naturally, 'vap' doesn't work because of the blank line. Is
> there a 'to outer-est block' sequence?

You might try

vnoremap <f4> V99[{o99]}

where "99" stands in for "sufficient levels of nesting". I was
surprised that "99a{" didn't behave as you (and I would) expect.

-tim


--
You received this message from the "vim_use" 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

No comments:

Post a Comment