In Vim, how can I delete everything between quotes including the quotes?

后端 未结 3 1711
庸人自扰
庸人自扰 2020-12-28 12:42

For example, in the following:

Testing \"deleting\" within quotes

With the cursor inside of deleting, how can I delete the text within the

3条回答
  •  感动是毒
    2020-12-28 13:16

    You can use the following sequence:

    da"
    

    Keep in mind this only works on a single line, and will remove any trailing spaces after the last quote.

    Edit

    As pointed out by @James in the comments below, you can also use the di" sequence (delete inside) to delete the characters within the quotes without deleting the quotes.

    You can also use this with ci" (change inside) to remove the characters and switch to insert mode, allowing you to easily replace text within quotes.

提交回复
热议问题