Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
zhjawe opened this issue Dec 12, 2014 · 6 comments
Open

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

zhjawe opened this issue Dec 12, 2014 · 6 comments

Comments

@zhjawe
Copy link

zhjawe commented Dec 12, 2014

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

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

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

@wklken
Copy link
Owner

wklken commented May 2, 2015

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

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

待处理

@yangjiandong
Copy link

参考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

@AngryHacker
Copy link

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

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

@Menghongli
Copy link

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

@e788b1
Copy link

e788b1 commented Jun 17, 2015

  • 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

@limboinf
Copy link

$ vim --version | grep clipboard

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

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

set clipboard=unnamed

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

andyt9527 pushed a commit to andyt9527/vim_config that referenced this issue Jul 17, 2020
🎨 Refactor core_config.vim.

Make the design clearer.

Close wklken#75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants