Sublime Forum

Record keystrokes to file

#1

I’ve been working on better keybindings for myself and while I know which shortcuts I tend to use the most it struck me that It would be useful with some empirical real data from my personal sublime usage so I can take an informed decision of which keys combos are actually used.

Is there some way to capture and record all input keystrokes sent to sublime (ST3) and write them to a file?

I’m happy to write a plugin if someone could prod me in the right direction also.

0 Likes

#2

If a key binding has keys: ["<character>"], then every character you type (except for modifier keys, backspace, space, tab & the like) are sent to the command registered to this keys.
E.g.

{
	"keys": ["<character>"],
	"command": "echo",
},

Now, if you save this in your User keymap file, every character you press will then be sent to the echo command and can be printed to the console. (This will disrupt your normal typing ability so having a context to limit it’s applicability is advised).
You can probably have a custom plugin that can use this & that writes the <character> received to a file.

1 Like