如何使用 vim 寄存器? [英] How do I use vim registers?
问题描述
我只知道一个使用寄存器的实例是通过 CtrlR* 粘贴剪贴板中的文本.
I only know of one instance using registers is via CtrlR* whereby I paste text from a clipboard.
寄存器的其他用途是什么?如何使用它们?
What are other uses of registers? How to use them?
您对 VI 寄存器的所有了解(让我们关注 vi 7.2)——与我们分享.
Everything you know about VI registers (let's focus on vi 7.2) -- share with us.
推荐答案
Vim 中的寄存器允许您对存储在其中的文本运行操作或命令.要访问寄存器,请在命令前键入 "a
,其中 a
是寄存器的名称.如果要将当前行复制到寄存器 k
,你可以输入
Registers in Vim let you run actions or commands on text stored within them. To access a register, you type "a
before a command, where a
is the name of a register. If you want to copy the current line into register k
, you can type
"kyy
或者您可以使用大写字母附加到寄存器
Or you can append to a register by using a capital letter
"Kyy
然后您可以使用
"kp
在 Linux 上从系统剪贴板粘贴
To paste from system clipboard on Linux
"+p
从 Windows 上的系统剪贴板粘贴(或从 Linux 上的鼠标突出显示"剪贴板)
To paste from system clipboard on Windows (or from "mouse highlight" clipboard on Linux)
"*p
访问所有当前定义的寄存器类型
To access all currently defined registers type
:reg
这篇关于如何使用 vim 寄存器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!