簡體   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