Is there a quick way to delete brackets ( some string ) and then select "some string"?

ds( deletes them (using the surround plugin). vi( selects but only when they exist.

looking for normal mode.

  • If the expression ( some string ) is in a single line, then the markers `[ and `] will mark the start and end of the expression, so you could use `[v`] to select it. Unfortunately, that doesn't work when the expression spawns multiple lines...
    – filbranden
    Commented Feb 23, 2020 at 2:09

1 Answer 1



  1. vi( selects visual region within the brackets using the surround plugin.
  2. <Esc> stops the visual selection mode.
  3. ds( deletes the surrounding brackets using the surround plugin.
  4. gv restarts visual selection mode with the most recent visual selection, however it's tripped by the now missing brackets and the selection is shifted to the right by one character i.e. length of first surrounding character, here the (.
  5. h begins correcting the original position of the visual selection by moving the right edge of visual selection leftwards by one character.
  6. o transports cursor to the other end of the visual selection.
  7. h moves the left edge of visual selection leftwards by one character.

Essentially this solution is based on gv which reselects the most recent visual selection. You can adapt the rest of the key sequence to take care of any edge cases like if located at the end of line, or length of surrounding characters being more then 1 and uneven lengths, for e.g. html tags like <strong></strong> etc.

  • 1
    Yeh, I knew something like this would work, but not fund of it. See if anyone got something better.
    – eyal karni
    Commented Mar 2, 2020 at 19:11
  • You can also save marks. I would do ma%mbx`axv`b
    – eyal karni
    Commented Mar 3, 2020 at 23:27

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.