Reply to message «Re: Standard way to undo plugin mappings?», 
sent 19:49:10 10 May 2011, Tuesday
by Gary Johnson:

>     if strlen(maparg("}", "i"))
if !empty(...)

>     if strlen(maparg("}", "i"))
>         iunmap }
>     endif
silent! iunmap }

>     if strlen(maparg("}", "i"))
>         iunmap }
>     endif
>     if strlen(maparg(")", "i"))
>         iunmap )
>     endif
>     if strlen(maparg("]", "i"))
>         iunmap ]
>     endif
>     if strlen(maparg(":", "i"))
>         iunmap :
>     endif
for s:m in filter(['}', ')', ']', ':'], '!empty(maparg(v:val, "i"))')
    execute 'iunmap' s:m
endfor
unlet s:m
" or
for s:m in ['}', ')', ']', ':']
    silent! execute 'iunmap' s:m
endfor
unlet s:m

> 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:
I have done this by putting
    function! IMAP(...)
    endfunction
into ~/.vim/ftplugin/tex/my.vim. I find all those mappings created by latexsuite
using IMAP() very annoying, especially greek letters IMAPs.

Original message:
> 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

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to