如何在Vim中复制整行? [英] How to duplicate a whole line in Vim?

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

问题描述

如何以类似于IntelliJ IDEA / Resharper或中的 Ctrl + D 的方式在 Vim 中复制整行在 Eclipse 中是Ctrl + Alt + /

How do I duplicate a whole line in Vim in a similar way to Ctrl+D in IntelliJ IDEA/ Resharper or Ctrl+Alt+/ in Eclipse?

推荐答案

y y Y 复制行(助记符: y ank



d d d 删除行(Vim将您删除的内容复制到剪贴板状的寄存器中,就像 cut 操作一样)

yy or Y to copy the line (mnemonic: yank)
or
dd to delete the line (Vim copies what you deleted into a clipboard-like "register", like a cut operation)

然后

p p aste 复制或删除的文本 之后的当前行

P p 当前行之前粘贴复制或删除的文本

p to paste the copied or deleted text after the current line
or
P to paste the copied or deleted text before the current line

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

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