Reputation: 24324
For some reason my Vim has gotten pretty slow when I try to switch from Insert mode to Normal mode - sometimes I have to wait 2 seconds to make a switch, sometimes I have to press twice. It may be related to plugins (I have many of them installed at the moment) or to my own mappings.
How can I debug keypresses in Vim (for example, print to the log what actually happens when I press a certain key)?
Upvotes: 1
Views: 367
Reputation: 172590
You can capture a full log of a Vim session with vim -V20vimlog
. After quitting Vim, examine the vimlog
log file for suspect commands.
However, for this timing issue, there's probably an easier approach: The delay can only be caused by either a mapping on the <Esc>
key (especially in the terminal you have to deal with the ambiguity with escape codes, which also start with Escape), or by code run on InsertLeave
. So, check whether something's mapped:
:verbose imap <Esc>
and list (and then disable one by one) the autocmds:
:verbose autocmd InsertLeave
Upvotes: 2