Hari Krishna Dara wrote:
> I need to be able to create an imap for <Tab> when my plugin is
> toggled on, and unmap it when it is toggled off. What I would prefer
> is to restore the previous map of <Tab> rather than simply unmap it,
> but there is no straight-forward way to capture the existing map such
> that it can be restored later...[snip]
>   

You could see if cecutil's SaveUserMaps() and RestoreUserMaps() 
functions that I wrote will help you.  In particular:

SaveUserMaps("n","","<tab>","hkd")
SaveUserMaps("bn","","<tab>","hkd")

will save normal mode mappings for <tab>s (if any); the first one for 
ordinary normal-mode  maps, and the second one will append 
<buffer>-qualified maps for <tab>.  A  RestoreUserMaps("hkd") will then 
restore those maps (again, if any).  You can get a copy from my 
website:  http://mysite.verizon.net/astronaut/vim/index.html#CECUTIL .

The "hkd" is a suffix used to differentiate save-map groups (ie. in 
script space, there's a s:restoreusermaps_hkd variable used).

Regards,
Chip Campbell



--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui