2

Given a line like this:

<input class="submit" type="submit" value="update general">

What is the best way to jump directly to the value string block?

Usually I’d use ci" to when there is only one string in the line. But in cases with multiple strings, Im looking for a quicker way to jump to the nth " " block.

D. Ben Knoble
  • 26,070
  • 3
  • 29
  • 65
Vinn
  • 761
  • 1
  • 6
  • 17

3 Answers3

2

Like other text objects, i" takes a count: c2i", but the general expectation is for text objects to expand both ways, so it doesn't really help.

You could count your way to the relevant quote:

5f"

and then do your edit:

ci"

Or you could simply search for up in update:

/up<CR>

and then do your edit:

ci"

FWIW, I am very partial to the "search" method, which is my default navigation method.

Alternatively, you could look around for a plugin that provides exactly what you are looking for, in this case an XML attribute text object. Like this one (untested).

romainl
  • 40,486
  • 5
  • 85
  • 117
1

I would do: 5f"ci"

Where 5f" goes to the fifth quote (star for the third string).

For the nth string it would be: 2*n-1 instead of 5.

Vivian De Smedt
  • 16,336
  • 3
  • 18
  • 37
1

I would probably type fvf"ci" or fvwwci" (not sure how many ws it takes) because that’s faster for me than counting. Or even $F"ci", but that’s not as general.

D. Ben Knoble
  • 26,070
  • 3
  • 29
  • 65