1

Suppose a file has the text such as

Natural
Natural8Language

I want the whole word to be yanked/copied with easy key shortcuts

kmario23
  • 57,311
  • 13
  • 161
  • 150
  • this can be done by little script. let's say, pressing `X` vim does what you wanted. now your cursor is on `foo_bar`, and pressed `X`, what would happen? nothing yanked? so the `"` register saved your previous yanked text. you just press X, and don't know what would be yanked, is it a good idea? – Kent Feb 05 '14 at 09:57
  • Could you clarify? The whole text means the whole file? Do you mean a *file* contains the text instead of "A word has the text"? – Jens Feb 05 '14 at 10:08
  • https://stackoverflow.com/a/66910215/9384511 – ABN Apr 01 '21 at 19:09

2 Answers2

9
yiw

does what you seem to want with the sample provided. It's a very basic command.

romainl
  • 186,200
  • 21
  • 280
  • 313
1

Would yanking up to the next word boundary with yW (capital W) do what you want? You can paste the yanked word with p. I believe it doesn't get much shorter than that (other than mapping keystrokes).

Jens
  • 69,818
  • 15
  • 125
  • 179