I have some code structure e.g

    // Some content goes here
    // Some content goes here

I want to select the content inside { } in some case and also content inside with opening and closing brackets included in some case. How can I do that?

1 Answer 1


You can use text objects to accomplish this. Start a selection with v and then:

For selecting inside use: i{

For selecting the whole block including braces use: a{

You can also do this with any type of parenthesis by changing { to [ or whatever. It's worth taking a little time to learn text objects as they make vim a lot more powerful!

See :h text-objects for more info.

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.