I’ve created an updated version of my Keystroke-gui keylogger, which can be controlled by Vim Hooks. Keystroke is keylogger and visualizer which can be used for screencasts. This is especially useful when recording screencasts for Vim, because in Vim’s normal mode you cannot see what is typed, opposed to insert mode. But in normal made most of the “magic’‘ happens ;-) The new version of Keystroke can be controlled over a TCP socket. Actually it supports the following commands:

  • disable: disable the logger (actually just the visualization)
  • enable: enable the logger again
  • insertEnter: enter Vim’s insert mode
  • insertLeave: leave Vim’s insert mode

This TCP server is used by Vim to tell the Keystroke when vim is started, exited, and when it enters/leaves insertMode. Some helper BASH script which simply do a “echo ‘command’ | nc localhost 9999’ are use to form the client side of the communication. Vim’s autocmd feature is used to execute those scrips.

augroup logger
    autocmd!
    autocmd VimEnter * :call system('$HOME/vim/enable_logger')
    autocmd VimLeave * :call system('$HOME/vim/disable_logger')
    autocmd InsertEnter * :call system('$HOME/vim/insert_enter')
    autocmd InsertLeave * :call system('$HOME/vim/insert_leave')
augroup end

When Keystroke is set to insertMode it only displays control keys like <C-x><C-l> <tab>, or <enter>. Because the normal keys you see anyway in the buffer.

Of course keystroke is also useful for other types of screencasts, it is not limited to Vim. But the Vim support is unique afaik.

If you want to give it a try you can clone the git repo https://github.com/gergap/keystroke.git

This new feature is currently available only on the branch FEATURE\_MORE\_CONFIG. I’ll need more testing before I release it, but it works already.

What would be this post without a short demo? So here it comes (click on the GIF to show in full size):

demo

What is still missing: More config options to adapt to different situations. E.g. what keys get filtered and what keys are shown.

Have fun ;-)


Comments

comments powered by Disqus