Quickest way to change a pair of parenthesis to brackets in vim

后端 未结 6 1142
野的像风
野的像风 2020-12-30 02:00

I am new to vim and in the process of discovering tons of interesting things that one can using this powerful editor.

One particular thing that I need to do very fr

6条回答
  •  一个人的身影
    2020-12-30 02:27

    I would simply do it like this: %r]^or[.

    Here's an explanation:

    • f( -- put cursor on first parenthesis you want to change (if it's not already there).
    • % -- jump to the matching parenthesis.
    • r] -- replace the parenthesis with a bracket.
    • CTRL-O -- jump back to to first parenthesis.
    • r[ -- replace the parenthesis with a bracket.

提交回复
热议问题