How to move cursor to first word inside quotes?

I want to move cursor to content. I'm using ^ to move to first non-whitespace character, w to first word.

<div class="container">
|   <div class="content">
        <p>I love you.</p>
    </div>
</div>

The pipe (|) shows the cursor position. How can I move it to content word? Like this:

<div class="container">
    <div class="|content">
        <p>I love you.</p>
    </div>
</div>

Upvotes: 2

Views: 385

Answers (2)

Luc Hermitte
Luc Hermitte

Reputation: 32946

If you're not on the right line, you can search with: /".\{-}\<\zs\w

Upvotes: 0

B.G.
B.G.

Reputation: 6026

Depends on a little but on what you want to do, but basically this can be done with:

f"w

f jumps to the char specified next, so f" jumps to the first quote, and the following w moves to the next word. But usually you don't just want to go there, if you want to insert a word before "content", you can do it directly with:

f"a 

If you want to change the content inside the quote just do the following:

ci"

Vim will automatically jump to the next quote.

There are more similar commands, so you should tell us what you want to do exactly!

Upvotes: 4

Related Questions