Copy lines in visual mode in vim

柔情痞子 提交于 2019-12-02 14:08:32

Stay away from using CTRL-C/V and your mouse in vim, or at least until you're familiar with vim's way of text handling.

--

SHIFT-V to enter visual line mode

Press 3j to go down 3 lines, or press j 3 times

y to yank/copy, x to cut, p to paste after cursor, P to paste before cursor.

Using hjkl will improve your workflow greatly as you don't have to move your hands from the typing position to the arrows and the mouse.

There are a couple of ways to yank multiple lines without entering visual mode. One of which is to type <action><number><direction>. For example, y3j means to yank from your current row to 3 rows down.

If you want to yank the entire paragraph or sentence you're in, type yip (yank IN paragraph) or yis (yank IN sentence) respectively. You can also do yi" (yank IN ") or ya" (yank AROUND ") to yank everything that's surrounded by " on your current position.

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