Reputation: 4742
Editing in Vim I often find myself in a situation where I want to move the position of a closing bracket.
e.g. First i type
if a == 1 then
Then I realize I really wanted to have brackets around the 'a == 1' part so I go back and put a bracket in and end up with
if ()a == 1 then
I'm using auto-pairs plugin so the paired bracket is correctly generated.
My question is, what is the quickest way to get this to look like:
if (a == 1) then
For example currently I might
It seems like there should be a way to
Upvotes: 1
Views: 478
Reputation: 32966
With lh--brackets, you would simply have to select a == 1
and press (
.
The surround plugin have similar mappings (they require several keys pressed, but they follow more the vim spirit).
If you really want to stay in insert mode, you can press CTRL-V
twice, once before pressing (
, then before )
.
You can also select a == 1
, and type s(^R")
. (^R
is for CTRL-R
)
Upvotes: 2