Example line: ^ some_string : other_string $
.
How to yank some_string
before :
without the spaces|tabs?
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityExample line: ^ some_string : other_string $
.
How to yank some_string
before :
without the spaces|tabs?
As you probably know all commands are quite location dependent. So the best command will differ depending on your starting location.
yiw
will work fine if you are standing on the some_string
.
If you are on the line you can get there by ^
(go to beginning first word of the line)
Then yiw
to yank the word only. (thanks @statox)
^
and 0
did the same thing, good to know. And here i thought I had a pretty good understanding of vim!
– jaan
Jan 25 '18 at 12:58
yw
to avoid confusion for future users.
– statox♦
Jan 25 '18 at 13:01
s
insome_string
) you want to doyf:
to yank until:
? – statox♦ Jan 25 '18 at 10:00:
. Seems yiw can do the job. – Fisher Jan 25 '18 at 10:08yiw
is what you are looking for you can see more text objects there:h object-select
– statox♦ Jan 25 '18 at 10:13