Desmapear asignaciones de complementos de Vim

Is there a way to unmap mappings set by plugins? I'm currently calling exe ":mapclear" before my custom mappings in my .vimrc file, but the plugin files appear to be sourced after the vimrc file does. I have to resource my vimrc file again for it to work as expected.

I'm using Pathogen for sourcing plugins, which are all contained in my ~/.vim/bundle folder.

preguntado el 09 de enero de 11 a las 02:01

2 Respuestas

You could write the part with the mappings in your .vimrc in another file, say MyMaps.vim, and put this file in ~/.vim/after/plugin/. This should make your maps the default ones

Look also at the documentation of the plugins setting the mappings, some of them allow you redifine or deactivate the default mappings.

Respondido 27 Abr '20, 00:04

Thanks, this sounds like a cool trick, though it disconnects my configuration from my .vimrc file. - wlue

Regarding the issue of keeping the configuration in one place you can create a function with your mappings and then use an autocommand to call that function each time you enter a buffer: autocmd BufEnter * call MyMaps(). This would allow you to keep the configuration in your .vimrc file. I don't know about setting a second mapleader. - skeept

While snooping around my various plugins, I've found a kind of solution.

Unfortunately, a lot of the plugins (such as vim-surround, and vim-align, which in turn uses cecutil) add commands to my mapleader. Since I realised there actually are some key mappings from plugins I do use, I decided to set my mapleader back to its default (backslash) at the end of my vimrc file to prevent overlap.

The only problem I came across were mappings that were set in functions. When using au FileType html call ConfigHTML(), por ejemplo, el ConfigHTML() function would actually get called after the mapleader is set back to backslash.

Respondido el 15 de enero de 11 a las 02:01

What is your solution? - user3751385

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.