k-vim icon indicating copy to clipboard operation
k-vim copied to clipboard

希望设置和系统剪贴板交互的快捷键

Open zhjawe opened this issue 10 years ago • 6 comments

建议代码: " ,c 复制至公共剪贴板 vmap c "+y

" ,a 复制所有至公共剪贴板 nmap a <ESC>ggVG"+y<ESC>

" ,v 从公共剪贴板粘贴 imap v <ESC>"+p nmap v "+p vmap v "+p

zhjawe avatar Dec 12 '14 08:12 zhjawe

9.0版本暂不解决, 没找到满意的键位/插件 其实很早之前引入yankring的

https://github.com/vim-scripts/YankRing.vim https://github.com/svermeulen/vim-easyclip

待处理

wklken avatar May 02 '15 17:05 wklken

参考spf13:

" share system clipboard    
if has('clipboard')
        if has('unnamedplus')  " When possible use + register for copy-paste
            set clipboard=unnamed,unnamedplus
        else         " On mac and Windows, use * register for copy-paste
            set clipboard=unnamed
        endif
endif

yangjiandong avatar Jun 08 '15 07:06 yangjiandong

现在好像原生的 "+y 和 "+p 也无法复制粘贴吗?

@yangjiandong 这一段代码的作用是什么?用起来好像把 "+y / "+p 映射成文件内的复制粘贴了?

AngryHacker avatar Jun 17 '15 09:06 AngryHacker

set clipboard=unnmaed 之后就可以用y来复制到公共粘贴版 p来粘贴了

Menghongli avatar Jun 17 '15 11:06 Menghongli

  • archlinux wiki The vim* packages are built with no X support. As a consequence, the +clipboard feature is missing, so Vim will not be able to operate with the X11 primary and clipboard buffers. The gvim* packages provide also CLI version of Vim with full X support. --( archlinux wiki )
  • gentoo wiki Link console vim against X11 libraries to enable title and clipboard features in xterm
USE=X emerge vim
" share system clipboard    
if has('clipboard')
        if has('unnamedplus')  " When possible use + register for copy-paste
            set clipboard=unnamed,unnamedplus
        else         " On mac and Windows, use * register for copy-paste
            set clipboard=unnamed
        endif
endif

e788b1 avatar Jun 17 '15 12:06 e788b1

$ vim --version | grep clipboard

+前缀表示拥有的feature,-前缀表示未拥有。如果显示的是 + clipboard 就表示支持系统剪切板。

我建议 @wklken 可以在配置文件里默认全局都是vim与系统剪切板交互:

set clipboard=unnamed

个人觉得这样比较方便些。

limboinf avatar Dec 19 '17 04:12 limboinf