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. I first ventured into capturing the output of :imap command and extract the <rhs>, but this won't work for many scenarios (including the case of <script>). Even if Vim has a command or function to output a script to recreate the map, it won't work for all scenarios (e.g., the <script>), so I think what I need is a command to create a "copy" of an existing map. Using such a command, I can "copy" the existing map to a <Plug> map and when I need to restore it, "copy" back to the original. The implementation of such a copy should be simpler than other alternatives, assuming it involves an actual copy of the underlying map data from the source. I think the command can fall into the existing map family of commands, rather than become a completely new command, something like "[nvxsoilc]mapc[opy] <newlhs> <oldlhs>". Does anyone have a clue on the feasibility of such a command or a better alternative? Is there a workaround that doesn't required creating this new command?
-- Thanks, Hari --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_dev" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---