~/dojo $ nvim +VimDojo
vimdojo
Learn Vim motions, Neovim workflows and your own init.lua by solving tiny puzzles in real Neovim. Every key counts: beat par for three stars.
How it works
-
1 Get a puzzle
A short snippet of code or prose, and a goal: fix the typo, land on the bug.
-
2 Solve it with motions
Use real Vim keys. The timer starts on your first keystroke, and every key is counted.
-
3 Beat par
Match the level's par in keys and time for three stars. Then find a shorter way.
Try it
The demo needs a physical keyboard.
Install
Neovim 0.10 or newer. No dependencies. Then run :VimDojo.
lazy.nvim
{ "navasvarela/vimdojo", cmd = "VimDojo", opts = {} }
packer.nvim
use({ "navasvarela/vimdojo" })
vim-plug
Plug 'navasvarela/vimdojo'
rocks.nvim
:Rocks install vimdojo
setup() is optional; see the
configuration options.
Curriculum
Motions 104 levels
The editing language: from hjkl to text objects, registers, macros and Ex commands.
01 Basic Motions
Move without the arrow keys: h j k l, word motions, line edges, and file edges.
j l w b e $ gg ^
6 levels
02 Find and Jump
Get anywhere in a few keys: f t ; , for characters, { } for paragraphs, % for brackets, and counts.
f t ; , } { % count
6 levels
03 Operate
Operators plus motions: d, c, y, the dot command, and text objects.
dw dd cw di" ciw . dap yy p
8 levels
04 Visual Mode
Select first, act second: block selections that edit many lines at once, and pasting over a selection.
<C-v> I <C-v>$ A <C-v>d <C-v>c v p over a selection
5 levels
05 Search
Jump anywhere by content: / and ?, * under the cursor, n for the next match, and cgn to change matches one by one.
/ ? * # n cgn .
5 levels
06 Text Objects
Operate on structure from anywhere inside it: parentheses, brackets, tags, words and sentences.
ci( di[ cit daw yi{ das
6 levels
07 Transform
Change text without retyping it: case, numbers, joining lines, swapping and overwriting characters.
gU <C-a> g<C-a> J gJ x xp R r
6 levels
08 Registers and Macros
Named and appending registers, pasting from Insert mode, and macros: record once, replay anywhere.
"a "A <C-r> q @ macro macro stops on failure
5 levels
09 Ex Power
Command-line editing: substitute, global, sort, normal on ranges, and moving lines.
:s :%s :g :sort :norm :m
6 levels
10 Regex Power
Patterns that do the work a macro can't: very magic, groups and backreferences, zero-width matches, lazy repeats and lookaround.
\v \1 & \1 in the pattern \v<> \v(a|b) \u \zs \ze \{-} :s# \@! \@<!
10 levels
11 The Expression Register
Let Vim do the arithmetic: <C-r>= while typing, \= in substitutions and :put = to generate lines.
<C-r>= @" :put = map() \= submatch() line('.') \=@a unary + submatch(1) len() printf()
8 levels
12 Boss Levels
One realistic refactor per level, each several steps long. Nothing new here: everything you've learned, and the order you use it in.
CSV to table fields to getters require to import extract constants extract function git log to release notes rows to SQL
7 levels
13 Marks and Jumps
Stop counting lines: marks you set, the jumps Neovim remembers and the changes it tracks.
` ' d' d` m <C-o> g; `A
7 levels
14 Ex Ranges
Say which lines, then what to do: :t copies, :g picks, marks and patterns aim, and :argdo reaches every file.
:t :g/x/t$ :t.|s :g/a/,/b/ :g/x/-j :'a,'b :{range}g/^/m :argdo :n {files}
9 levels
15 Filters and Formatting
Hand lines to sort, rewrap prose with gq and gw, and let = fix the indentation.
! !G !! gqq gq gw == =i{ gg=G ! gq =
10 levels
Usage Neovim only 13 levels
Working in Neovim: windows, buffers, the quickfix list and the defaults it ships with. Each level opens a small project of real files.
16 Windows and Buffers
Split, swap, move and close windows, and hop between buffers.
<C-w>v :vsplit <Tab> completion <C-w>x <C-^> <C-w>o <C-w>L
6 levels
17 Project-Wide Edits
Work across files: follow paths, find files anywhere, and change every file at once with the quickfix list.
gf :vimgrep :cdo :find
3 levels
18 Neovim Built-ins
Defaults that ship with modern Neovim: commenting, repeating :s, quickfix and diagnostic jumps.
gc g& ]q [q ]d [d
4 levels
Setup Neovim only 18 levels
Write and fix an init.lua. Your config runs in a sandboxed Neovim that checks what it does, and shows you as you type what still fails.
19 Options and Keymaps
Write your own init.lua: options, the leader key, and keymaps that do what they say.
vim.o vim.g.mapleader shiftwidth expandtab smartcase <cmd> desc
6 levels
20 Autocommands and Commands
React to events: yank highlights, filetype settings, trim on save, and augroups that survive re-sourcing.
TextYankPost vim.hl.on_yank FileType BufWritePre augroup
4 levels
21 Fix the Broken Config
Each config is broken in a way people really break theirs. Find the bug, fix it with as few keys as possible.
mapleader order option types <CR> in mappings vim.g vs vim.o user commands
5 levels
22 Modern Neovim
APIs and defaults from Neovim 0.11: diagnostics, window borders and the new LSP config.
vim.diagnostic.config winborder vim.lsp.config
3 levels
Every level's solution is proven in real Neovim on every change, and pars are honest. Want to add a level? Packs are plain JSON: write your own.
Levels by @navasvarela (177 levels).