vim - 如何在每行下分别复制多行并多次粘贴?
问题描述
原文如下。我想复制每一行并分别在他们自己的行下粘贴多次。
USD
XYZ
ABC
YUT
LMO
.
.
. upto so on
想让他们变成这样。无论如何,我怎样才能在 Vim 中实现以下目标?
USD
USD
USD
USD
USD
USD
XYZ
XYZ
XYZ
XYZ
XYZ
ABC
ABC
ABC
ABC
ABC
YUT
YUT
YUT
YUT
YUT
LMO
LMO
LMO
LMO
LMO
.
.
. upto so on
解决方案
一种选择是查找/替换整个文件
%s/.*/&\r&/gc
分解
%s start a substitute on the entire file
.* capture the entire line to be replaced
&\r& replace with the entire captured group. Add \r& as amount of required duplicates
推荐阅读
- python - Django rest框架AttributeError:'function'对象没有属性'get_extra_actions'
- php - 更新条带连接帐户的法人实体
- laravel - Laravel - getQueueableRelations & 循环关系
- javascript - 如何对 DevExtreme Grid 中的选择列应用排序?
- javascript - 使用变量显示错误警报,但如果我直接使用值,那么它的工作
- java - 关闭或修改浏览器 Java 中的当前选项卡 url
- php - 来自 Twilio 的拨出电话在 Laravel 5.5 中不起作用
- gnuplot - 在多图中设置唯一图例
- android - SpeechRecognizer 提供多种语言的结果,但我只想要一种语言
- c# - 检查 IEnumerable
填满了不计入的可选词