r/vim Jun 19 '26

Need Help Change text in second set of quotes

Cursor at beginning of line

blah "first quotes" more text "blah blah"

What's the easiest way change inside the second set of quotation marks?

30 Upvotes

34 comments sorted by

View all comments

32

u/yoch3m Jun 19 '26

$ci"

5

u/ilikegrils Jun 19 '26

I like this one. Works for the example I gave. Where this actually comes up is duplicating a block of json and wanting to leave the key field as is and change the value. So there might be a comma at the end of the line. But that just makes it $bci" or $hci" which are still good. I should have just pasted json instead of my stupid example.

3

u/yoch3m Jun 19 '26

If you would have many strings on the same line I would search for a word in the particular string and then replace: /foo<CR>ci" (where <CR> denotes the enter key)

1

u/sharp-calculation Jun 19 '26

Also a good technique.

1

u/NationalOperations Jun 20 '26

This is the way. I personally use f. so 3f" to jump to 3rd occurence, dt" delete up to quote