Is there a tool or plugin for a learner which can display the keyboard shortcuts or abbreviated versions for commands after they are typed in?If for instance I use : to get the command line and execute :tabnew the plugin should display whatever keyboard shortcut that is bound to that command for a few seconds or until the next command is typed in.Take this question - https://stackoverflow.com/questions/6467634, the author wants to set a shortcut for the NERDTree command. I am not interested in using the shortcut itself. I want to type :NERDTree itself and get a notification that ,ne has been mapped to it. I don't want to break my workflow to look up the shortcut, ie I don't want to lookup the key mapping before hand, just to know it and use it if I find it convenient.Assuming I am sitting at someone else desktop with their own customizations, to get a job done. It is not really practical for me to lookup their shortcuts when I know the full commands. I just use the full command and if the notification shows me that their customization is convenient for me then I use it.It should work whether they are built in defaults, set by plugins or are user configured, or even if the commands have multiple alternatives.This question is about a plugin which displays keyboard equivalents of commands typed in the command line, in realtime. It is meant to show the keyboard shortcut for a command after it has been used. It is not to lookup the keymapping for that command.
Is there Vim plugin that can show keystroke maps or abbreviations for command after it is used?
key bindings;plugin system
I came up with with a quick solution. It needs some improvements but you couldtake it as a base.So your problem can be divided in two mains problems:How can I get the mappings associated to a command?How can I execute a function after each command I use?To start with the second one we can use a quick workaround: We can simply remap <CR> in command mode, this way we can make it call a function each type we press it to execute our command.This probably has some huge drawbacks that I don't know so far.cnoremap <CR> <CR>:call ShowMappings()<CR>With this code we say to vim Call the function ShowMappings() each time<CR> is pressed.Since we want to use the last executed command in our function, we can usegetreg() to get the content of the : register which contains our command.The function ShowMappings() will look like this:function! ShowMappings()    let cmd = getreg(':')    echo Mappings for  . cmdendfunctionNow the part where we want to get the mappings associated to our command:The map command gives all of the available mappings. The filter commandallows us to filter the output of another command. So this code will show all ofthe mappings including the command CtrlP:filter /CtrlP/ mapNow all we need to do is to use it in our function:function! ShowMappings()    let cmd = getreg(':')    echo Mappings for  . cmd    execute 'filter /' . cmd . '/ map'endfunctionIf you put everything together you get the following code:function! ShowMappings()    let cmd = getreg(':')    echo Mappings for  . cmd    execute 'filter /' . cmd . '/ map'endfunctioncnoremap <CR> <CR>:call ShowMappings()<CR>Don't hesitate to use it and improve it to make your own plugin. If I get sometime I'll try to make one.