gpt4 book ai didi

ubuntu - 在选项卡或终端之间轻松复制/粘贴 vim

转载 作者:行者123 更新时间:2023-12-04 18:44:42 24 4
gpt4 key购买 nike

我应该在 vimrc 中添加哪一行以便在终端之间或不同文件/选项卡之间轻松复制/粘贴?

我现在有:

" Better copy & paste
set pastetoggle=<F2>
set clipboard=unnamed

我将 vim 用作 Python IDE,到目前为止从未遇到过问题,但它似乎无法处理 2 个不同文件/选项卡之间的复制/粘贴。

我应该添加哪一行?你用什么在不同的终端或标签之间复制/粘贴?

最佳答案

这是个人喜好,但我使用标准:

"+y
"+p

我喜欢它默认工作,对我来说,它已成为一个“手指宏”,我可以轻松快速地输入。如果您愿意,您可以将它们分配给其他东西,但我发现这可以正常工作。

在下面的 wiki 中链接了一个 vimtip,它将序列重新映射到以下内容:
vmap <C-Space> "ay
nmap <C-Space> "aP
imap <C-Space> <C-o>"ap
nmap <C-c> "ayiw

vimwiki 解释: https://vim.fandom.com/wiki/Copy,_cut_and_paste

unlike most text editors, Vim distinguishes between its own registers and the system clipboard. By default, Vim copies to, cuts to, and pastes from its own default register, called the unnamed register ("", also called quotequote) instead of the system clipboard.

Assuming Vim was compiled with clipboard access, it is possible to access the "+ or "* registers, which can modify the system clipboard. In this case, one can copy with e.g. "+y in visual mode, or "+y{motion} in normal mode, and paste with e.g. "+p.

If your installation of Vim was not compiled with clipboard support, you must either install a package that has clipboard support, or use an external command such as xclip as an intermediary. See Accessing the system clipboard for detailed information.

关于ubuntu - 在选项卡或终端之间轻松复制/粘贴 vim,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54872056/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com