wlue
wlue

Reputation: 473

Unmapping Vim Plugin mappings

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.

Upvotes: 8

Views: 2030

Answers (2)

skeept
skeept

Reputation: 12423

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.

Upvotes: 6

wlue
wlue

Reputation: 473

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(), for example, the ConfigHTML() function would actually get called after the mapleader is set back to backslash.

Upvotes: -1

Related Questions