Skip to content

Neovim for Mere Mortals

Vim is the editor you meet on every server: fast, modal — you command the text in one mode and type new text in another — and older than most of the machines it runs on. Neovim is its modern fork. The name is literal: a new Vim. In 2014 a developer named Thiago de Arruda forked Vim's code to rebuild its insides, and the project that grew from that fork keeps everything your fingers learned in Vim — the modes, the motions, the grammar of operators and text objects — while replacing the parts that had stopped growing: the scripting language, the plugin machinery, and the long list of features an editor was once expected to borrow from outside programs.

This guide explains what changed and why it matters. Neovim is configured in Lua, a small real programming language, instead of Vimscript alone. It has a language server client built in, so the same program that powers code intelligence in big IDEs can answer Neovim's questions about your code. It parses your files with Tree-sitter, so highlighting understands the shape of the program instead of guessing from patterns. And it can run headless — no screen at all — which is how this guide's lab proves every claim: the editor was driven by scripts against real files, and the files were read back from disk to show the edits landed.

One rule belongs up front, because later chapters will ask you to install other people's code:

A plugin is a program that runs with your full user powers. Install only plugins you would be willing to run as programs — from projects you can name, at versions you chose. Chapter 6 returns to this at the moment of installing.

The lab behind this guide ran the real thing: Neovim 0.12.6, from the official release tarball, on a small Linux machine. Against it the lab made edits three ways — Ex commands typed at the editor's command line, real Normal-mode keystrokes fed by a script, and Lua scripts calling the editor's API — and read every edited file back from disk. It wrote an init.lua that set options, a leader key and a mapping, and proved each one by asking the editor what it held. It registered an autocmd and watched it fire. It ran :checkhealth and kept the whole report, warnings included. It parsed Lua and Python with Tree-sitter and printed the syntax trees' shape. It downloaded a real language server (lua-language-server 3.19.2), attached it with nothing but the built-in client, and jumped from a function call to its definition. It installed a plugin with the built-in vim.pack, and another plugin — five lines of Lua the lab wrote itself — by hand, the old way.

What the lab could not do, it did not fake. It had no graphical session, so the interactive screen is taught from the keystrokes the lab did drive headlessly plus the project's documentation, and the text says which is which. One install route (the AppImage) needs a FUSE device this machine does not have, so that route is described, not run. The transcripts in neovim-lab/transcripts/ are the evidence; criteria.md keeps the full ledger of what was run and what was only read.

What this guide covers

  • What Neovim is — the fork, what it kept, what it rebuilt, and who it is for
  • Installing Neovim — the release tarball, packages and the AppImage, the version check, and the four folders Neovim keeps its life in
  • Your first edit — modes in one page, a real edit taken keystroke by keystroke, buffers, windows and tabs, and getting out alive
  • Configuring with Lua — init.lua, options with vim.opt, the leader key, and your first mapping, each proven by asking the editor
  • Lua automation — the vim API, autocmds that react to what you do, your own commands, and the ways of running Lua
  • Plugins — what a plugin actually is, a five-line plugin installed by hand, the built-in vim.pack, and the trust rule
  • Tree-sitter — parsers and syntax trees, the parsers Neovim ships with, and installing more, including the two failures the lab hit on the way
  • The language server client — language servers explained, the client Neovim builds in, and a real definition jump against a real server
  • Recipes — fix a typo in every file at once, edit what a pipe sends you, and check a file without opening the editor
  • The neighbours — Vim itself, VS Code, Emacs and the other modal editors: what each does that Neovim doesn't, and vice versa
  • Limits — the learning curve, the per-language homework, the moving ecosystem, and the terminal's edges, stated plainly
  • Troubleshooting — the broken init.lua, the config that silently never loaded, the parser that would not build, and the traps this guide's lab fell into so you don't have to
  • Glossary — the terms, collected in one place

What it doesn't cover

Modal editing itself, in depth. The grammar of Vim — operators, motions, text objects, registers, macros — is a book of its own, and it is the same grammar here; the series' Vim guide teaches it properly, and chapter 3 of this guide gives you the one-page version you need to follow along. Building a full IDE is likewise out: chapter 8 attaches one language server for real and names what a complete setup adds, but a distribution-sized configuration — the pre-made bundles of plugins that turn Neovim into someone else's IDE — is pointed at, not taught, because you would learn their choices instead of the editor. Writing plugins for publication, embedding Neovim inside other programs, and the remote plugin hosts for other languages are pointed at in chapter 11 and left there.

How to use this guide

Read chapter 1 for the model, and chapter 2 before installing anything — knowing which folder holds what turns later confusion into a named problem. Chapter 3 makes your first edit in the same sitting as the install. Do not skip chapter 4's habit of asking the editor what it loaded: half of chapter 12's troubles are a config that never ran, and the asking is how you know. Chapters 7 and 8 are the two that make Neovim more than a faster Vim; do them in order, because the language server chapter borrows the parser chapter's vocabulary. The lab's transcripts live in neovim-lab/transcripts/; its configuration is neovim-lab/config/, its scripts neovim-lab/scripts/, its hand-written plugin neovim-lab/plugin/, and its specimen files neovim-lab/files/.


Part of the series

This guide is one of the For Mere Mortals guides: plain-language guides to the tools programmers and makers use.

Related guides:

License

The writing in this guide is licensed under CC BY 4.0. Code examples and lab scripts are licensed under the MIT License.