简体   繁体   中英

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.

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. Even the highlight on mouse in vm mode doesnt work. 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.

These map the command not to y , but to <leader>y . By default, the leader key is a backslash, so the command is really bound to \\y . You can change that by setting the mapleader variable to something else before mapping a command to a key sequence incorporating it:

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

Now the function would be bound to ,y instead of \\y .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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