使用 yat 命令复制后复制 html 块的最佳方法

Best way to duplicate block of html after copying it with yat command

我有小html码:

<div class="form-group">
  <label for="" class="col-sm-2 control-label">Name</label>
  <div class="col-sm-10">
    <input type="text" class="form-control">
  </div>
</div>

第 3 行 <div class="col-sm-10"> 字母 m 上的提示。 现在我输入 yat 来复制这个 div。 将其粘贴到此 div 下面的最佳方法是什么,所以我得到:

<div class="form-group">
  <label for="" class="col-sm-2 control-label">Name</label>
  <div class="col-sm-10">
    <input type="text" class="form-control">
  </div>
  <div class="col-sm-10">
    <input type="text" class="form-control">
  </div>
</div>

现在我在做:yat jj o <esc> p ==

我会做以下事情:

vatVy'>p

说明

  • 视觉上 select 标签 (vat) linewise (V)
  • Yank/copy 文字 (y)
  • 移动到视觉对象的末尾 selection ('>)
  • Put/paste 块 (p)

使用内置命令,我会这样做:

vatVyP

V 将按字符选择变成按行选择,因此可以按原样粘贴。我在上面粘贴 P 以避免移动。

插件解决方案

在我的 LineJuggler plugin 中,有一个视觉模式重复映射 ]d,简称:

vat]d