This is an example script which is meant to print the keyboard shortcut for a command.
Applying it clears the screen output. The result of commands like
version get cleared off the screen when it is enabled. Currently it only calls
echomsg when the last command is
tabnew yet the screen gets cleared when any other command is applied.
Why is this happening?
cnoremap <silent> <cr> <cr>:call <SID>CommandCallback()<cr> function! s:CommandCallback() let last_command = @: if last_command =~ 'tabnew' echomsg "Tabnew was called" endif endfunction
PS: The question where this script came from - https://stackoverflow.com/questions/43691961