How to replace text between quotes in vi

后端 未结 6 2020
无人共我
无人共我 2020-12-07 12:12

Say I have this line of code:

$query = \"SELECT * FROM table\";

Is there a command in vi/vim which can instantly delete everything between

6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-07 12:45

    The chosen answer is suitable ONLY for ViM but NOT for vi. The question is inaccurate as well because the author did not mention what is initial position of the cursor. If we assume that the cursor is inside the double quotes then for vi the answer will be:

    T"ct"
    

    Where:

    T" - move back just after the " character

    c - change command

    t" - provide end position for c command, where it should stop erasing characters, in other words the range to change

提交回复
热议问题