Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

vim

People also ask

How do I delete all words in Vim?

Immediately after opening a file, type “gg” to move the cursor to the first line of the file, assuming it is not already there. Then type dG to delete all the lines or text in it.

How do you wrap a word in a quote in Vim?

press q and q for recording into q register (we use "q" as shortcut to remember "quotes"). press a then press ' again to surround the word with quotes.

How do I delete a word before the cursor in Vim?

d<leftArrow> will delete current and left character. d$ will delete from current position to end of line. d^ will delete from current backward to first non-white-space character. d0 will delete from current backward to beginning of line.


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


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"