7

In my vimrc I have:

nnoremap <F4> :SyntasticToggleMode<CR>

And this works.

But I also have the unicode.vim plugin installed, which overrides this mapping:

if !hasmapto('<Plug>(MakeDigraph)', 'n')
    nmap <F4> <Plug>(MakeDigraph)
endif

I "fixed" this by doing:

nnoremap <F13> <Plug>(MakeDigraph)
vnoremap <F13> <Plug>(MakeDigraph)

Since <F13> is a key I happen to not use... But this is obviously fragile and doesn't scale well.

Is there a better way to accomplish this?

1 Answer 1

2

There is no good solution, at least as far as I know. Well-written plugins allow you to configure their key combinations. But if a plugin really doesn't "cooperate", there isn't much you can do to stop it from hogging the keys it wants. At best you can wait for it to do its thing, then re-assign its keys to something else from some after file, or after it has finished loading. But re-assigning keys isn't always possible, since some maps reference <SID> and other file-scoped symbols, and there may not be any global symbol to hook to. There is no equivalent of lockvar for key maps.

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.