我知道如何在vim中使用v命令,但我需要一些东西,这将删除整个行,它应该允许我粘贴相同的行在其他地方。
当前回答
切线有几种方法,均由普通模式下的d键控制。如果你正在使用可视模式(v键),你可以点击d键,一旦你突出显示了你想要切割的区域。移动到您想要粘贴的位置,并按p键进行粘贴。
It's also worth mentioning that you can copy/cut/paste from registers. Suppose you aren't sure when or where you want to paste the text. You could save the text to up to 24 registers identified by an alphabetical letter. Just prepend your command with ' (single quote) and the register letter (a thru z). For instance you could use the visual mode (v key) to select some text and then type 'ad to cut the text and store it in register 'a'. Once you navigate to the location where you want to paste the text you would type 'ap to paste the contents of register a.
其他回答
切线有几种方法,均由普通模式下的d键控制。如果你正在使用可视模式(v键),你可以点击d键,一旦你突出显示了你想要切割的区域。移动到您想要粘贴的位置,并按p键进行粘贴。
It's also worth mentioning that you can copy/cut/paste from registers. Suppose you aren't sure when or where you want to paste the text. You could save the text to up to 24 registers identified by an alphabetical letter. Just prepend your command with ' (single quote) and the register letter (a thru z). For instance you could use the visual mode (v key) to select some text and then type 'ad to cut the text and store it in register 'a'. Once you navigate to the location where you want to paste the text you would type 'ap to paste the contents of register a.
只需三步。
转到文本的开头,按下v 到文本的最后,按d键 到你想要粘贴的地方,按p
回到这一行,先按esc,然后Shift + v。
(这将突出显示这一行)
按d
(该行已被删除)
到你想要粘贴的位置,点击p。
简而言之,
Esc -> Shift + v -> d -> p
在正常模式下按“V”键选择整条线 然后按“y”复制它 到你想要粘贴的地方,按“p”粘贴光标后或按“p”粘贴光标前。
我发现最快的方法是通过编辑模式:
按yy复制该行。 然后dd删除该行。 然后p来粘贴直线。