lowercasename
lowercasename

Reputation: 281

In Vim, can I yank from a specific character behind the cursor to another after the cursor?

Let's say I'm on the following line, and the vertical bar represents my cursor:

<div class="|foo">Some text</div>

I need to copy the whole start tag my cursor is currently on (<div class="foo">), but then I need to change the class value, so I don't want to move my cursor after the yank is complete. Is there a command to copy from < to > - something like F<yf>, but without losing my place in the line?

Upvotes: 1

Views: 201

Answers (1)

romainl
romainl

Reputation: 196876

ya<

yanks <div class="foo"> and moves the cursor to <. See :help text-objects.

To move the cursor back to where it was before, use :help ``:

ya<``

Upvotes: 3

Related Questions