在Vim中以可视模式复制行 [英] Copy lines in visual mode in vim

查看:216
本文介绍了在Vim中以可视模式复制行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是有关gVim中复制/粘贴工作流程的问题。

Just a question about copy/paste workflow in gVim.

现在我正在处理文档。我想选择一些代码行,然后复制并粘贴。我正在使用gVim(Windows)。

Right now I'm working on a document. I want to select some lines of code and copy and paste. I'm using gVim (Windows).

如果我使用Control + C和Control + V,gVim有时需要2、3秒才能粘贴...

If I use Control + C and Control + V, gVim takes sometimes 2, 3 seconds to paste...

另一种方法是使用Shift + v(对,现在我处于可视模式),然后按住Shift键并用鼠标拖动选择。现在,我可以使用 y或 c进行复制,并使用 p进行粘贴。这是更快的方法,但是我必须按住Shift键。

The other way is using, Shift + v (right, now I'm in visual mode), then I keep the Shift key pressed and drag my selection with the mouse. Now I can copy with 'y' or 'c' and paste with 'p'. This is faster, but I have to keep the Shift key pressed.

有没有一种方法可以在不按住Shift键的情况下使用鼠标在可视模式下选择文本?我想使用y / d / p代替缓慢的Control + c和Control + v。是否有更好的工作流程或设置值得我尝试?

Is there a way to use the mouse to select text in visual mode without keeping the Shift key pressed? I want to use y/d/p instead of slow Control + c and Control + v. Is there a better workflow or setup that I should try?

谢谢,

[]'s

Mateus

推荐答案

不要在 vim中使用 CTRL - C / V ,或者至少直到您熟悉 vim 的文本处理方式。

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 进入视线模式

3j 向下3行,或按 j 3次

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

y 进行粘贴/复制, x 进行剪切, p 粘贴到光标之后, P 粘贴到光标之前。

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

使用 h j < kbd> k l 可以极大地改善您的工作流程,因为您不必将手从打字位置移到箭头和鼠标上。

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.

有两种方法可以在不进入可视模式的情况下拉动多行。其中之一是键入< action>< number< direction> 。例如, y3j 表示从当前行向下拖动3行。

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.

如果要拉整您所在的整个段落或句子,请键入 yip (拉紧IN段落)或 yis (猛拉IN语句)。您还可以执行 yi (在 中单击)或 ya (拉动 )以拉动当前位置上 包围的所有内容。

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.

这篇关于在Vim中以可视模式复制行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆