nvie / vim-togglemouse

Toggles the mouse focus between Vim and your terminal emulator, allowing terminal emulator mouse commands, like copy/paste.
http://www.vim.org/scripts/script.php?script_id=3166
51 stars 22 forks source link

How do you "remap" the key #2

Closed delcypher closed 11 years ago

delcypher commented 11 years ago

Your guide says

If you don't want to use the <F12> key for mouse toggling, simply remap it to another key. It autodetects whether it has been remapped and won't register the <F12> key if so.

I'm confused, I'm not sure how to "remap" a key (when I look this up all I find are things like noremap, which is a recursion free key mapping definition). I took a look at the code and it looks like if I could map a key to your s:ToggleMouse() function (before loading your plugin) then that would work and <F12> would not be mapped. The problem is I don't know how to call that function because it looks like s is replaced with a autogenerated name by vim to avoid naming conflicts.

How are you supposed to do this?

nvie commented 11 years ago
    noremap <F12> :call <SID>ToggleMouse()<CR>

Just replace <F12> with whatever key you wish to remap it to.

delcypher commented 11 years ago

Thanks for the reply. I am looking for a way to do this without modifying your plug-in if possible.

I manage my plugins using Vundle so I'm trying to avoid modifying the plug-in unless I have to.

Doing this in my .vimrc seemed to work

map <C-m> :call <SNR>28_ToggleMouse()<CR>
Bundle 'nvie/vim-togglemouse'

But I don't think this is portable. Is there an intended way to do this? Thanks.