I just started working on a tool to help me increase my productivity with Vim. I want it to log every keystroke to a file and then identify inefficient usage patterns. I would like it to store a timestamp for every keystroke.
I've tried using the -w and -W vim options to dump every keystroke to a pipe. However, Vim doesn't report keystrokes on-line and so I could not obtain reliable timestamps.
I've also tried intercepting input from a tty, writing it to a pipe and redirecting it as stdin for Vim. But then Vim just quits with:
Vim: Warning: Input is not from a terminal
I've also found this trick to capture every key: http://vim.wikia.com/wiki/Capture_all_keys. I don't know anything about vimscript, but I get a feeling that's not what I'm looking for.
So my thinking now is: I need to intercept input from a tty, process it and then write it to some fake tty that Vim will use as an input. Would you agree that's the best approach to take? If so, any hints on how I could do that?