Vim: changing/deleting up to the end of a “block”

前端 未结 4 2074
感动是毒
感动是毒 2021-02-01 07:11

When you have a block of text delimitated by brackets or quotes, you can use

ci\"
da(

and so on to change that block of text. But is there a wa

4条回答
  •  心在旅途
    2021-02-01 07:40

    Use ct) to “correct till closing parenthesis”.

    Vim motions with t, f, T and F are very, very useful. :help t, :help f.

    Update: If there are nested parentheses where you are:

    • vi)o`` will select till closing parenthese (will select inside parentheses, then switch to other end of the selection and move it to where you were (``)
    • vi)`` will select till opening parenthese (same mechanism, but without needing o)

    The first one works only because when you are doing vi) a cursor jump is remembered, and `` goes to previous cursor location. It seems that o in visual mode does not affect this.

提交回复
热议问题