How to enclose curly braces in parenthesis in vim? Initial string:
{a: b}
Final string:
({a: b})
The string possibly span multilines:
{
a: b
}
Assuming you are in normal mode and on any curly bracket character (opening or closing). The manual/vanilla version (without any bracketing plugin) would be
c%(^R")
With:
^R meaning CTRL+R") being filled with the content of the dictionary.ca{ that should be used instead of c% if you're anywhere within the dictionary.With my lh-brackets plugin, I would use v%( or vi{( -- unlike the vanilla version, will leave the default register unmodified.
With the popular surround plugin, I guess (I may be wrong as I've been using my plugin for decades) it would be something like ys%( or ysa{(.
PS: the fact your dictionary spans on several lines doesn't make any difference here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With