繁体   English   中英

我的 .vimrc 文件的复制/粘贴问题

[英]Copy/paste issue with my .vimrc file

当我尝试在可视模式下复制然后粘贴它时,它只是粘贴一个新行而不是复制的行。 当在 root 下使用 .vimrc 做同样的事情时,它工作正常。

这是我目前使用的.vimrc 感谢您提供任何帮助,并且在 linux 中使用相同的 .vimrc 时要注意一件事,它可以正常工作。

:help unnamedplus

向我提供这些信息

 clipboard-unnamedplus unnamedplus A variant of the "unnamed" flag which uses the clipboard register '+' (quoteplus) instead of register '*' for all yank, delete, change and put operations which would normally go to the unnamed register. When "unnamed" is also included to the option, yank operations (but not delete, change or put) will additionally copy the text into register '*'. Only available with the +X11 feature. Availability can be checked with: if has('unnamedplus')

vim.wikia 关于Mac OS X 剪贴板共享的文章建议使用

set clipboard=unnamed

还要看看像autoselectautoselectplus这样的选项

:help autoselect
 clipboard-autoselect autoselect Works like the 'a' flag in 'guioptions': If present, then whenever Visual mode is started, or the Visual area extended, Vim tries to become the owner of the windowing system's global selection or put the selected text on the clipboard used by the selection register "*. See guioptions_a and quotestar for details. When the GUI is active, the 'a' flag in 'guioptions' is used, when the GUI is not active, this "autoselect" flag is used. Also applies to the modeless selection. clipboard-autoselectplus autoselectplus Like "autoselect" but using the + register instead of the * register. Compare to the 'P' flag in 'guioptions'.

既然你提到它在 Linux 下工作,我假设你的错误是在 Windows 或 OSX 上。 正如@sudobangbang 所提到的,您的问题在于行set clipboard=unnamedplus

这样做是将 vim 的默认复制缓冲区设置为+ ,这是 Linux 使用的 X Window 剪贴板的 vim 别名。 不知道为什么它只给你新的线路,但这可能与它与操作系统的交互方式有关

要使其适用于 Windows 和 OSX,您需要使用命令set clipboard=unnamed将复制缓冲区设置为* ,这是 Windows/OSX 中剪贴板的别名。

但是,如果您完全删除该行,则可以通过执行"*y"*p using "来引用*缓冲区,然后是您的命令,从而手动从系统复制缓冲区复制/粘贴

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM