6

Let's say I have this piece of code (cursor/selection is represented by []):

[f]unction a()
{
    // ...
}

If I want to select the function declaration and the curly braces (and of course the content) I can do Vj%, which select the first line, goes to the opening { and jump to the matching }.

Or I can do jVa{ok which goes down to select around the {}, goes back to the start of the selection and move up to select the remaining line.

Now the question: why can't I do Vja{?

I thought it could select the first line, then move down and expand around the curly braces.

Why is this not possible?

1 Answer 1

9

It's trying to select the block that encompasses all of the selection. Since your selection is "leaking" out of the block and there's no other block containing it, it fails. Try Vja{ on this to see what I mean:

{
   [f]unction a()
   {
       // ...
   }
}
1
  • Nicely found, I thought the "inside"/"around" were for the cursor and not the position.
    – nobe4
    Jun 23, 2016 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.