Search code examples
searchvimreplaceparentheses

Surround parentheses with its content by extra parentheses


I have lines that I want to convert from

(variable=value)

to

((variable=value))

How should I go about doing that from the vim command line?


Solution

  • May be you can use following substitute command

    :%s/(.*)/(&)/g
    

    where

    .* - all strings of characters of any length and
    &  - the whole matched pattern