当我尝试在可视模式下复制然后粘贴它时,它只是粘贴一个新行而不是复制行。当在root下完成相同的事情时,它会使用.vimrc它可以正常工作。
这是我目前使用的.vimrc。 任何帮助是值得赞赏的,有一点需要注意.vimrc在linux中使用时工作正常。
答案 0 :(得分:1)
: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')
关于Mac OS X clipboard sharing的vim.wikia文章建议使用
set clipboard=unnamed
另请参阅autoselect
和autoselectplus
: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'.
答案 1 :(得分:0)
既然你提到它在Linux下运行,我认为你的错误是在Windows或OSX上。正如@sudobangbang所提到的,您的问题在于行set clipboard=unnamedplus
这样做是将vim的默认复制缓冲区设置为+
,这是Linux使用的X Window剪贴板的vim别名。不知道为什么它只给你新线,但它可能与它与操作系统的交互方式有关
要使其适用于Windows和OSX,您需要使用命令set clipboard=unnamed
将复制缓冲区设置为*
,这是Windows / OSX中剪贴板的别名。
但是,如果您完全删除该行,则可以使用"*y
执行"*p
和"
来引用*
缓冲区,从系统复制缓冲区手动复制/粘贴通过你的命令