简体   繁体   English

无法在.vimrc中使用此功能

[英]Unable to get this function working in .vimrc

Not sure if this is the best place for this question but following this http://vim.wikia.com/wiki/Using_the_Windows_clipboard_in_Cygwin_Vim article I put this function Putclip in my vimrc however it doesnt seem to get triggered. 不确定这是否是这个问题的最佳位置,但是按照这篇http://vim.wikia.com/wiki/Using_the_Windows_clipboard_in_Cygwin_Vim文章我把这个函数Putclip放在我的vimrc中,但它似乎没有被触发。

vnoremap <silent> <leader>y :call Putclip(visualmode(), 1)<CR>
nnoremap <silent> <leader>y :call Putclip('n', 1)<CR>

I thought the above two calls to the function should work in vm mode or normal mode when pressing y command. 我认为按下y命令时,上述两个函数调用应该在vm模式或普通模式下工作。 Even the highlight on mouse in vm mode doesnt work. 甚至vm模式下鼠标的亮点都不起作用。 Can someone please let me know what im doing wrong. 有人可以让我知道我做错了什么。

I use cygwin as the environment to do this and using vim version 7.3. 我使用cygwin作为环境来执行此操作并使用vim 7.3版。

These map the command not to y , but to <leader>y . 这些命令不是映射到y ,而是映射到<leader>y By default, the leader key is a backslash, so the command is really bound to \\y . 默认情况下,leader键是反斜杠,因此命令实际上绑定到\\y You can change that by setting the mapleader variable to something else before mapping a command to a key sequence incorporating it: 在将命令映射到包含它的键序列之前,您可以通过将mapleader变量设置为mapleader变量来更改它:

let mapleader = ","
vnoremap <silent> <leader>y :call Putclip(visualmode(), 1)<CR>

Now the function would be bound to ,y instead of \\y . 现在函数将绑定到,y而不是\\y

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM