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

心已入冬 提交于 2019-12-30 22:51:30

问题


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 can I yank the word without hitting b first?


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/8652526/is-it-possible-to-yank-the-entire-element-without-moving-to-the-beginning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!