0

I'm dealing with the following text and want to select "abc def":

    123
    abc def
    456_4

I've tried viw but it can only select a whole word isolated by spaces, and v$ starting with cursor on "a" which selects both "abc def" but also the last Enter unexpectedly.

Any way to only select "abc def" precisely?

0

1 Answer 1

1

You can use v$ if you follow it with h. But there's a better motion we can use than $, i.e. g_. This moves to the last non-blank character of the line.

So...

vg_

Since you mentioned text objects (iw), it's worth noting that you can precede them with a count.

As long as the cursor is on one of the letters of abc, this will select the desired text:

v3iw

Alternatively, with aw:

v2aw

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.