Vim quick way to change method arguments

One of the most common source code operations is changing method arguments. Given a list of method arguments as follows:

("argument1","argument2","argument3")

I want to know how to handle the following operations (I use |here as the cursor position):

  • When the cursor is inside the quotation marks, and you want to delete the contents inside the quotation marks. for example: "ar|gument1"to"|"
  • same as the first, but remove the quotes.
  • delete all things in brackets. ("argument1","argument2","argument3")before(|)
+5
source share
2 answers

Try the following commands:

  • di"(mnemonics: delete iniside ")
  • da"(mnemonics: removal around ")
  • di( dib (: () )

(.. ), c d.

, :help text-objects.

+10
  • " ", bdw - , , .
  • " ", F"df" - " , " (). , .
  • " " - %c%()<esc> - , :) , ().
0

All Articles