Is it possible to yank the entire element without moving to the beginning?

前端 未结 2 1058
鱼传尺愫
鱼传尺愫 2021-01-19 16:12

When my cursor in middle of a word, and I want to yank the whole word, I must press b first, and press yw to yank it.

I want to know

相关标签:
2条回答
  • 2021-01-19 16:47

    yaw is yank around word, meaning if there is a space after the word, it will grab it too (but not a space before).

    yiw is yank inside word, which yanks just the word characters.

    You can see what will be yanked by vaw or viw to select the same characters. You could then also hit y to perform the yank.

    i and a of course apply to all the other VIM groups, like W, which is any non whitespace.

    0 讨论(0)
  • 2021-01-19 17:08

    You can use yaw. As a side effect, this will move the cursor to the beginning of the yanked area.

    For more information, see Text object selection in the Vim documentation.

    0 讨论(0)
提交回复
热议问题