I'm wondering if it is possible to check in vimscript if a key (or key combination) is already bound?
I know about the
:map command which lets me see visually which keys are bound to what actions, but what I am looking for is a way to check it programmatically and perform actions conditionally.
My concrete scenario is the following: I like the the possibility to dynamically/manually map
<leader><leader> to what I need in different cases. (eg. while programming python: run the script. Or compile while programming c++). I usually do it by typing
:nmap <leader><leader> :!make && run program manually while editing.
Now I want to check in my
.vimrc if the combination is already bound (by a plugin, or manually) and if not map it to a default action.
In short words: How can I map a key only if it is not already bound?