dev-tools 6 min read

hjkl: a browser game for drilling Vim commands

hjkl is a free browser game that drills Vim motions, text objects, counts and search inside a real Vim editor. No sign-up, no install, and no account.

#vim #dev-tools #learning#editor
By
Share: X in
hjkl, a browser game for practicing Vim commands, shown in a dark editor window

TL;DR: hjkl is a free browser game that drills Vim motions, text objects and counts inside a real Vim editor. Pick a skill, then edit the same target six times: two guided edits with a live hint, two prompted edits, then two on your own. No account, no install, and progress lives in memory only until you close the tab.

What it is

hjkl is a keyboard-first Vim practice game by Duy Hua, running entirely in the browser as a Next.js app. The editor inside is CodeMirror with Vim keybindings, so the motions and operators you press are the ones you would type in a terminal. Each challenge hands you a document with a target and asks you to make the text match.

Nothing is stored. There is no account, no sign-up and no saved data, and progress lives in memory while the page is open. A full cheat sheet at /commands lists every command the game teaches, grouped by the skill that teaches it, and a plain text llms.txt at the root lays out the whole curriculum.

The app also registers itself with browsers that support document.modelContext (WebMCP), exposing two tools, read_game_state and request_hint. An agent driving the page can read the current goal and advance the hint ladder the same way the interface does.

Why it matters

The real barrier to Vim is retention, not comprehension. Almost everyone can follow ciw or daw the first time they see them, and just as many have forgotten them by Friday unless they get used.

hjkl is built around that gap instead of around the documentation. Rather than reading about counts, you are asked to move three words and then two lines in a row, with the feedback loop of a game instead of a tutorial. Because each skill is separate, you can drill the one motion you keep dropping rather than replay a whole course from the start.

It is also free and open on the web with nothing to install, which removes the usual friction of getting a team to adopt anything. Open the URL on a laptop and start.

The curriculum

Sixteen skills, ordered roughly from single keystrokes to multi-key movement. Every selected skill runs the same six-edit ladder:

  • Two guided edits, with a live hint under the editor naming the key to press
  • Two prompted edits, where the hint stays visible until you begin editing and then gets out of the way
  • Two independent edits, with no hint at all

The skills and the keys they drill:

SkillKeys
Fix a typox, h, l
Change a wordw, b, ciw
Remove a linej, k, dd
Trim a phrasev, h, l, d
Move a sentencedd, j, k, p
Insert texti, a, I, A, o, O
Replace a characterr
Copy textyy, yw, p, P
Use counts3w, 2dd, 3x, 3p
Find within a linef, F, t, T, ;, ,
Search documents/, ?, n, N
Edit text objectsci", ci', ci(, diw, daw
Repeat edits.
Match delimiters%
Jump through files12G, gg, G, ctrl-o, ctrl-i
Set and return to marksma, 'a, `a

Passing a challenge does not require one blessed key sequence. Any edit sequence that produces the target counts, which matters for skills like finding a character, where f, t and a search all reach the same place.

Getting it running

There is nothing to install. Open the URL in a desktop browser:

# macOS
open https://hjkl.duy.run/

# Linux
xdg-open https://hjkl.duy.run/

Two requirements are worth knowing before you start. A physical keyboard is required, since the entire point is muscle memory on real keys, and the viewport needs to be at least 768px wide, so a phone browser will not work.

Inside the editor, type :help in Normal mode to see the commands for the level you are on. Escape or q closes it. A drill for the change-a-word skill looks like this:

" move onto the word, change everything inside it
ciw

" the dot command repeats the last change on the next word
.

If you want a reference to check your answers against, the real thing is one command away:

vimtutor

What to watch for

The launch thread on Hacker News is worth reading, because the criticism is specific and mostly fair. One commenter pointed out that where dw would delete a word, hjkl teaches vlllld, which trains a habit of reaching for visual mode instead of the operator. Another flagged that the editor’s control-A increment does not behave exactly like real Vim when a block is selected, since the simulator increments only the number under the cursor while real Vim increments all of them.

The sidebar is the gap that stands out most in a tool aimed at Vim users. You cannot drive the challenge list with Vim motions yet, which is the part of the interface a Vim trainer most needs to get right. The author has it on the list.

Smaller things from the thread: the skill grid cells are not fully clickable, only the cells themselves, and one user had to reach for the mouse to navigate, which undercuts the keyboard-first premise. Someone wanted the challenges shuffled rather than grouped, and suggested building the thing around vim.golf.

Nothing persists. Progress is in memory for the lifetime of the page, so there is no streak, no history and no way to return to what you were drilling yesterday. For a tool whose whole purpose is retention over time, that is the part that would matter most to fix next.

Source and Accuracy Notes