You can use maplist()
to get a list of mappings; this returns a list with information about every custom mapping.
You can see the exact list of properties it returns in :help maplist()
; the one important for us here is lhs
("left hand side"), which is the key mapping. For example for nnoremap <Leader>tc …
it's set to '\ts'
, assuming that <Leader>
is the default of \
(<Leader>
is expanded when used, so it shows up as a backslash).
To unmap everything, you can use something like:
for m in maplist()
if m.lhs[0] == '\'
echo printf('unmap %s', m.lhs)
exe 'unmap' .. m.lhs
endif
endfor
Note that this doesn't necessarily truly remove all mappings, because some plugins may define buffer-specific mappings from an autocmd which will be applied every time a buffer is loaded. Unsetting those would be complex and error-prone, but you can run the above in your autocmd (although that would also remove your own mappings). In general it's probably a better strategy to configure the specific plugins, many have some sort of setting to prevent defining any mappings (and if they don't, creating a patch is usually easy, and thus far everyone I've sent a patch for this has accepted it).