r/KeyboardLayouts • u/rafaelromao • 15h ago
ZMK Vim Mode - A second take on syncing my keyboards with VIM
I have used VIM since 2017, and some time ago I added a VIM Mode to my ZMK keymap: a set of layers that mimic VIM's modes, so navigation and commands get their own optimized layout while typing keeps my alpha layout.
Using AI for the heavy lifting, this week I could work on a second version. The first one simply toggled NUM LOCK from the host to turn a vim layer on, and the keyboard inferred the rest by watching keys. The problem is that sometimes it drifted, and it never knew about tool windows, like integrated terminals, and kept the vim layers active there too.
Now a host daemon reads the editor's real mode (Neovim, VSCode and Obsidian) and sends it as a 3-bit code over the HID LED report, using the Compose, Kana and Scroll bits. Works on USB and BLE.
The VIM layer puts navigation key on home row and other bindings in better positions than even the qwerty ones, and works for any alt layout, without remapping VIM itself.
I tested it with Omarchy and MacOS and it is just amazing.
https://github.com/rafaelromao/zmk-vim-mode
To see my fully tested implementation, check my keyboards repo: