Code at the speed of thought
Unlock unlimited potential on any keyboard
Introduction
If like me you spend hours of your time coding then you likely waste most of your time just moving your hands to use the arrow key, mouse or to press numbers. Most of us are using idiotic default layouts designed for typewriters. Kanata changes that. It’s an incredibly powerful software keyboard remapper that brings QMK/ZMK firmware-level features to any keyboard you plug into your computer.
In this guide, I’ll walk you through my personal configuration and how you can use it to speed up your workflow.
The Home Row Mods
Most of us move our fingers up and down hundreds of times to use the arrow keys, type numbers, or symbols. This compounds when coding as most characters are symbols. The solution is to use different keybindings for different Layers. Instead of stretching your fingers to hit distant numbers and arrow keys, you simply hold down the keys already under your fingers.
If you tap the key, it sends the normal letter. If you hold the key, it acts as a modifier or switches to a different layer (like a navigation or symbol layer).
Here is a snippet of my .kbd configuration establishing the source keys and the aliases for the Layer toggles:
;; Comprehensive Kanata Configuration File
;; Features: Layer toggles, Home Row Mods (HRM), and a Navigation layer
(defcfg
process-unmapped-keys yes
)
;; The physical layout of keys we intend to map
(defsrc
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ]
caps a s d f g h j k l ; ' ret
lsft z x c v b n m , . / rsft
lctl lmet lalt spc ralt rmet rctl
)
;; Powerful dual-role Home Row Mods
;; Syntax: (tap-hold tap-timeout hold-timeout tap-action hold-action)
(defalias
;; Left hand - A S D F
met-a (tap-hold 200 200 a lmet)
alt-s (tap-hold 200 200 s lalt)
sft-d (tap-hold 200 200 d lsft)
ctl-f (tap-hold 200 200 f lctl)
;; Right hand - J K L ;
ctl-j (tap-hold 200 200 j rctl)
sft-k (tap-hold 200 200 k rsft)
alt-l (tap-hold 200 200 l ralt)
met-; (tap-hold 200 200 ; rmet)
;; Caps Lock repurposed as a Layer Toggle (Hold) and Escape (Tap)
nav (layer-toggle navigation)
cap (tap-hold 150 150 esc @nav)
)
;; Base layout utilizing our aliases
(deflayer base
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
grv 1 2 3 4 5 6 7 8 9 0 - = bspc
tab q w e r t y u i o p [ ]
@cap @met-a @alt-s @sft-d @ctl-f g h @ctl-j @sft-k @alt-l @met-; ' ret
lsft z x c v b n m , . / rsft
lctl lmet lalt spc ralt rmet rctl
)
;; Navigation Layer (Activated by holding Caps Lock)
;; Puts arrow keys on H J K L (Vim style)
(deflayer navigation
_ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ left down up right _ _ _
_ _ _ _ _ _ home pgdn pgup end _ _
_ _ _ _ _ _ _
) Now, by holding Caps Lock, H J K L instantly become my arrow keys. But the physical setup extends far beyond basic navigation.
Here is the complete breakdown of functions mapped across the layout:
1. The Navigation & Editing Layer (Hold CapsLock)
When you hold CapsLock, the navigation layer activates. This layer gives you full control over text manipulation without ever taking your hands off the home row.
- Vim-style Arrows:
H J K Lbecome your arrow keys. - Paging:
U I O Phandle Home, PageUp, PageDown, and End. - Editing: Your left hand (
Z X C V B N M) gets instant, zero-stretch access to Undo, Cut, Copy, Paste, Redo, Delete, and Insert.
J ← K ↓ L ↑ ; → U Home I PgUp O PgDn P End
N Del M Ins Q-P = F1-F12 A-H = F7-F12
Z Undo X Cut C Copy V Paste B Redo 2. The Numbers & Symbols Layer (Hold Right Alt)
Coding involves typing a massive amount of symbols ({}, (), !=, =>, etc). Reaching up and stretching for the number row repeatedly breaks your physical cadence. Holding Right Alt brings all numbers and associated symbols down directly under your resting fingers.
- Numbers: The top row (
QtoP) becomes1through0. - Primary Symbols: The home row (
Ato;) turns into! @ # $ % ^ & * ( ). - Brackets & Operators: The bottom row accesses your remaining development symbols like
- _ = + [ ] { } \ |.
Q 1 W 2 E 3 R 4 T 5 Y 6 U 7 I 8 O 9 P 0
A ! S @ D # F $ G % H ^ J & K * L ( ; )
Z - X _ C = V + B [ N ] M { , } . / |
' ` (grave) 3. The System & Media Layer (Hold Tab)
Finally, holding Tab acts as your hardware-level OS interface, completely eliminating the need to physically reach for a mouse when reading documentation.
- Mouse Emulation:
H J K Lmove the mouse cursor across the screen.U I Oact as Left, Right, and Middle clicks. - Scrolling:
Pand;scroll the page up and down. - Media Controls: Your left hand handles Volume, Mute, Play/Pause, and Track skipping on the bottom row.
H ← J ↓ K ↑ L → (mouse) U L-Click I R-Click O M-Click
P ScrollUp ; ScrollDown
Z Vol- X Vol+ C Mute V Play B Prev N Next , Media
Q PrtSc W ScrLk E Pause R Menu
A F13 S F14 D F15 F F16 How to Use This Configuration on NixOS
If you are using NixOS like me, setting up Kanata is incredibly elegant because you don’t need to manually mess with uinput device groups, systemd services, or downloading binaries. It is all handled natively and declaratively through NixOS modules.
1. Enable the Kanata Service
Open your configuration.nix (or wherever you manage your system services) and enable the Kanata service. You can embed the entire configuration string directly into your Nix file:
services.kanata = {
enable = true;
keyboards = {
internalKeyboard = {
# Add the appropriate device ID/path for your laptop or external keyboard if needed
# devices = [ "/dev/input/by-path/platform-i8042-serio-0-event-kbd" ];
# Paste the entire configuration (defcfg, defsrc, defalias, deflayer) here
config = ''
(defsrc
esc f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12
;; ... the rest of the config block goes here ...
)
'';
};
};
}; 2. Apply the Configuration
Rebuild your NixOS system to apply the new hardware service:
sudo nixos-rebuild switch As soon as the rebuild finishes, the systemd service is automatically created, the kernel uinput permissions are granted, and your new layout is immediately live. Hold down your Caps Lock key and try using H J K L to navigate around!
Conclusion
Switching to a programmable keyboard architecture like this takes a few days of muscle memory retraining. But once you stop stretching your pinky to hit Ctrl, and stop moving your entire right hand to reach the arrow keys, the ergonomic benefits are permanent. Give it a try, and you might never look at a standard keyboard the same way again.