How to map yank to OS's clipboard in Vim? [duplicate]

筅森魡賤 提交于 2020-01-13 11:11:52

问题


Possible Duplicate:
vim: copy selection to OS X clipboard

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.

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.

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.

I want to add stuff like:

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.

Am I clearer?

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


回答1:


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.



来源:https://stackoverflow.com/questions/11416253/how-to-map-yank-to-oss-clipboard-in-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!