In Vim, how do I delete everything within the double quotes?

Vim

Vim Problem Overview


Assuming I'm inside the quotes already.

Vim Solutions


Solution 1 - Vim

Try the following sequence, which can be thought of as "d"elete, "i"nside, quotes, so: di"

Solution 2 - Vim

The following sentence drops everything inside the quotes while being in normal mode:

di"

where:

  • d is for delete
  • i is for "inner", just inside the following marker.
  • " is for specifying that you will delete inside the quotes.

Note that it is not needed to be inside the quotes when you call it, the own command looks for the first occurence of text inside quotes in the current line and deletes it, so you can save some key strokes.

Additionally, if you are interested in deleting the quotes too, then apply the following command (a means "and around it")

da"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTIMEXView Question on Stackoverflow
Solution 1 - VimHerbert SitzView Answer on Stackoverflow
Solution 2 - VimatureganoView Answer on Stackoverflow