如何在Vim中将yank映射到OS的剪贴板? [英] How to map yank to OS's clipboard in Vim?
问题描述
可能重复:
vim:将选择内容复制到OS X剪贴板
Possible Duplicate:
vim: copy selection to OS X clipboard
虽然我成功地从剪贴板映射了 paste
(nmap <leader>p "*p
),但对于yank
(nmap <leader>y "*y
)来说却一样.实际上,它是放在Vim的剪贴板中的.
While I succeeded to map paste
from clipboard (nmap <leader>p "*p
), the same for yank
(nmap <leader>y "*y
) doesn't seem working. Actually, it yanks in Vim's clipboard.
任何想法如何正确执行?我知道clipboard=unnamed
,但是我可能会保留旧的yank/paste vim的命令.
Any idea how to do it properly? I know of clipboard=unnamed
but I might keep the old yank/paste vim's commands.
编辑:看来我的需求有些混乱.
EDIT: It seems there is some confusion about my needs.
命令"*y
有效.因此,我的Vim env中的+clipboard
没什么错.映射的东西是行不通的.
The command "*y
works. So there is nothing wrong with the +clipboard
thing in my Vim env. What does not work is the mapping stuff.
我想添加以下内容:
nmap <leader>y "*y # Doesn't work as expected. It copies only in Vim's clipboard, ie I have to type `p` to paste the copied content instead of `"*p`.
nmap <leader>p "*p # Works as expected.
我更清楚吗?
第二个编辑:以防万一,因为我不知道有什么可以帮助您的,所以我的计算机中提供了vim --version
的呈现器:
2nd EDIT: Just in case, 'cause I have no idea what could help you helping me, there is the render of vim --version
in my machine: https://gist.github.com/3090385
推荐答案
如果在拉动之前进行视觉选择,则需要vmap
而不是nmap
.否则,yank是正常命令,并且需要运动命令.
If you're visually selecting before yanking then you need vmap
not nmap
. Otherwise, yank is a normal command and is expecting a motion command.
这篇关于如何在Vim中将yank映射到OS的剪贴板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!