What is difference between Vim's clipboard “unnamed” and “unnamedplus” settings?

本文介绍了Vim中unnamed与unnamedplus两种剪贴板设置的区别及使用场景。在MacOSX和Windows上,这两种设置效果相同,而在Linux环境下则有所不同。为了实现跨平台的一致体验,建议同时使用这两种设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://stackoverflow.com/questions/30691466/what-is-difference-between-vims-clipboard-unnamed-and-unnamedplus-settings
What is the difference between these 2 settings?

set clipboard=unnamed
set clipboard=unnamedplus
Which one should I use in order to have multi-platform .vimrc?

On Mac OS X and Windows, the * and + registers both point to the system clipboard so unnamed and unnamedplus have the same effect: the unnamed register is synchronized with the system clipboard.

On Linux, you have essentially two clipboards: one is pretty much the same as in the other OSes (Ctrl+C and Ctrl+V in other programs, mapped to register + in Vim), the other is the “selection” clipboard (mapped to register * in Vim).

Using only unnamedplus on Linux, Windows and Mac OS X allows you to:

Ctrl+C in other programs and put in Vim with p on all three platforms,
yank in Vim with y and Ctrl+V in other programs on all three platforms.
If you also want to use Linux’s “selection” clipboard, you will also need unnamed.

Here is a cross-platform value:

set clipboard^=unnamed,unnamedplus
Reference:

:h ‘clipboard’
(and follow the tags)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值