Simple Vue directive for hotkeys
I’m a fan of hotkeys and I use them for a lot of things. In fact, I believe that 80% of the commands I use in my IDEs (Visual Studio and Visual Studio Code mostly) I use via hotkeys. Nothing is better than
CTRL + p in VS Code or
CTRL + k + d in VS. Anyway, while a lot of users really don’t care about that, those that have data entry intensive use cases will probably appreciate some forethought in hotkeys in the apps they use.
For that matter, Vue already have a couple of good hotkey frameworks called v-hotkey and v-shortkey. However, what they don’t provide is a way to not just listen to key combinations but also key sequences (gmail style). To me, that’s essential in web applications since the browser already handle keys like
Here is a simple vue component that demonstrates the directive:
As simple as this tool is, it has been enough for some of my project needs. PRs are welcome and I will share if anything new come up.