Tuesday, May 10, 2011

Re: Standard way to undo plugin mappings?

On 2011-05-10, Nathan Neff wrote:
> I'm using a plugin (BufExplorer) that maps <leader>be, <leader>bs,
> etc. The BufKill
> plugin also maps quite a few things to <leader>bX
>
> I want <leader>b only (no other <leader>bX mappings) so that there's no delay
> when I type <leader>b.
>
> What's the best way to unmap or turn off these mappings?
>
>
> I've looked for a switch or options in BufExplorer to turn off these
> mappings, but there is none.
>
> I realize that I can comment out the mappings, but that feels hacky,
> and if there's an upgrade, I'll
> have to do it again.
>
> Is there a "standard" way to undo mappings that are created by
> plugins? For example, should I
> use an "after" script to undo these mappings?

I don't know if there is a "standard" way to do this, but I
disabled some of the Vim LaTeX Suite mappings I didn't like by
putting the following in ~/.vim/after/tex.vim:

if strlen(maparg("}", "i"))
iunmap }
endif
if strlen(maparg(")", "i"))
iunmap )
endif
if strlen(maparg("]", "i"))
iunmap ]
endif
if strlen(maparg(":", "i"))
iunmap :
endif

Testing for the existence of each mapping before unmapping it
avoided error messages in cases where the mapping didn't exist.

HTH,
Gary

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments: