One thing to notice is that, in your specific case, the mappings are not exactly the same.
Plug-in todo.txt-vim
creates a buffer-local mapping for <LocalLeader>b
for filetype todo
(which the plug-in registers for files named todo.txt
and similar variations):
nnoremap <script> <silent> <buffer> <localleader>b :call todo#txt#prioritize_add('B')<CR>
Plug-in vim-buffergator
, on the other hand, creates a global mapping for <Leader>b
:
nnoremap <silent> <Leader>b :BuffergatorOpen<CR>
Since one mapping is local and the other global, the effect will be predictable and consistent. Local mappings always take precedence over global ones, so in this case the mapping from todo.txt-vim
will be the one that's active in a buffer with filetype todo
. Once you move to a buffer with a different filetype, the global mapping from vim-buffergator
will once again get active (it's not clobbered by the other definition, both still exist, though in todo
buffers where a local mapping also exists it will take precedence.)
For cases such as this one, another alternative you have other than disabling one of the mappings is to set distinct leader key sequences for global and local mappings, which is actually possible since <Leader>
and <LocalLeader>
are actually distinct (even though by default they map to the same character, backslash.)
For example, to keep backslash for global mappings but use "space" for local ones, you can add the following to your vimrc:
let g:maplocalleader = '<Space>'
In your situation, that would keep \b
for the vim-buffergator
mapping and would use <Space>b
for the todo.txt
one.
This might affect many (half?) of your existing mappings, so it might take some getting used to... You'll need to "learn" which mappings are local and which are global (though typically that should be mostly obvious since the local ones are normally attached to a specific filetype.)
See :help mapleader
and the section on maplocalleader
that follows for more details.