从外部来源复制和粘贴 [英] Copy and paste from external source

查看:33
本文介绍了从外部来源复制和粘贴的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 vim(实际上是 Windows 上的 gvim)作为我的主要文本编辑器.在我的工作流程中,我必须将句子复制到/从各种外部来源复制,因此我使用 clipboard=unnamed 来保存我的击键(p 而不是*p").
我从外部源复制文本,我想将其粘贴到 vim 中的 两个 不同位置.我标记第一个 (v),然后使用 p 粘贴它.问题是此时我丢失了原始缓冲区并且无法将其粘贴到第二位.它不存在于未命名缓冲区、* 缓冲区或编号缓冲区中.我的猜测是粘贴选择是将粘贴"文本放入未命名的缓冲区中.
如何将原始字符串粘贴到两个位置?即防止它从缓冲区中丢失.

I use vim (Actually gvim on windows) as my main text editor. In my work flow I have to copy sentences to/from various external sources, therefore I use clipboard=unnamed to save me key strokes (p instead of "*p).
I copy text from an outer source and I want to paste it over two different places in vim. I mark the first one (v) and then use p to paste over it. The problem is that at this point I lose the original buffer and can't paste it in the second place. It does not exist in the unnamed buffer, the * buffer or the numbered buffers. My guess is that pasting over selection is putting the "pasted over" text in the unnamed buffer.
How can I paste my original string in two locations? i.e. prevent it from getting lost from the buffers.

谢谢.

推荐答案

试试这个:

:vmap p "_xP

  • vmap 表示制作仅适用于可视模式的映射.
  • p 是为其创建映射的关键.
  • "_ 是黑洞寄存器.它用于任何您想要删除文本而不影响任何寄存器的情况.
  • xP 表示删除选定的文本,然后粘贴到结果光标位置之前.
    • vmap means to make a mapping that only applies in visual mode.
    • p is the key to create the mapping for.
    • "_ is the black hole register. This is used in any situation where you want to delete text without affecting any registers.
    • xP means delete the selected text, then paste before the resulting cursor position.
    • 这篇关于从外部来源复制和粘贴的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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