如何在vim的ex模式下从缓冲区粘贴? [英] How to paste from buffer in ex mode of vim?

查看:155
本文介绍了如何在vim的ex模式下从缓冲区粘贴?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从文件中复制某些文本,然后将其复制到新的拆分窗口时遇到问题.
3yy | new | p

I am having a problem in copying certain text from a file then copying it to a new split window.
3yy|new|p

在命令模式下其工作

当我按下

'p' 它的工作

推荐答案

我了解您要执行以下操作:

I understand that you want to:

  1. 在当前缓冲区中添加当前行和下面的两行,
  2. 在新的水平拆分中打开一个空缓冲区,然后
  3. 将这三行粘贴到空缓冲区中.

对吗?

我不明白的是为什么您希望从Ex模式下进行操作,而在普通模式下它是如此简单(并且可以正常工作):

What I don't get is why you would want to do it from Ex mode while it's so easy (and working) in normal mode:

3yy
:new<cr>
p

我认为您混淆了 ex 模式(可以通过Q访问)和 command 模式(可以通过:访问).您可能还会混淆:p[rint]命令和:pu[t]命令.

I think that you are confusing ex mode, accessible with Q and command mode, accessible with :. You probably also confuse the :p[rint] command and the :pu[t] command.

正常模式下执行以下操作:

Do the following from normal mode:

:.,+2y|new|put!

了解到您也可以使用以下命令将这三行直接写到文件中可能会有所帮助:

It may be helpful to know that you can also directly write those three lines to a file with:

:.,+2w filename

这篇关于如何在vim的ex模式下从缓冲区粘贴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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