在vim中,如何将一列文本粘贴到不规则长度行的末尾? [英] In vim, how do I paste a column of text to the end of irregular length lines?

查看:40
本文介绍了在vim中,如何将一列文本粘贴到不规则长度行的末尾?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在不规则长度的行的末尾粘贴一列文本.

I would like to paste a column of text at the end of irregular-length lines.

例如,我想粘贴以下内容:

For example, I would like to paste the following:

SRR447882.fastq.gz
SRR447883.fastq.gz
SRR447944.fastq.gz

在这些行的末尾:

TIL01_
TIL01_
TIL04-TIP285_

过去很多时候,我只是在第一行留出足够的空间,这样粘贴就不会出现在最长行中现有文本的结尾之前.但随后我需要返回并删除空格.

Many times in the past, I simply create enough space on the first line that pasting will not come before the end of the existing text in the longest line. But then I need to go back and remove whitespace.

我试过在谷歌上搜索vim 列粘贴不规则长度的行"和类似的查询.

I have tried googling "vim column paste irregular length rows" and similar queries.

推荐答案

你可以这样做:

  • 从第二个块的第一行开始
  • qq,开始录制q
  • 4k,上四行
  • d$,删除到行尾
  • 4j,回到上一行
  • $p,粘贴到行尾
  • q,停止录制宏
  • jVG,往下走一行,选择剩余的行
  • <代码>:规范!@q,将宏应用于选择
  • Start on the first line of the second block
  • qq, start recording the q macro
  • 4k, go up four lines
  • d$, delete till the end of line
  • 4j, go back to the previous line
  • $p, paste the line at the end of the line
  • q, stop recording the macro
  • jVG, go down one line and select the remaining lines
  • :norm! @q, apply the macro to the selection

然而,它确实在之前的文本所在的位置留下了空间.@Kent one's 还是比较容易的.

It does however leave space where the previous text was. @Kent one's is still easier.

这篇关于在vim中,如何将一列文本粘贴到不规则长度行的末尾?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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