The VikiD Truth

Knowledge base / Computing / Tools & dev workflow

computingFreedom | Build | Picolisp | Picolisp Machine | Pil Sources | Linux | BASH | C-Programmming | Operating Systems | Javascipt | Emacs | vim | Pharo Smalltalk | Computer Security | Python | The Compiler | Identifiers | Literals | storage_linkage | emacs | computing | vim notes

Vikid’s Vim Notes

Here below are the various notes that I take time to time on vim. It’s not intended to be complete but a quick help about certain vim functions or operations that are helpful.

Goto line Vim

The plain idea

Vim is a modal text editor: unlike most editors, where the keys always type letters, Vim has different modes, chiefly Normal mode (where keys are commands: move, delete, copy) and Insert mode (where keys type text). That split is Vim’s whole secret. Your fingers spend most of their time issuing fast, composable commands from the home row, and only drop into Insert mode to actually write. This page collects my running notes on those commands.

Why it matters

Vim (and its modern successor Neovim) is everywhere: it is installed on virtually every server, so when you SSH into a remote machine, Vim is the editor you can count on. Its editing “language”, verbs (d delete, c change, y yank) combined with motions (w word, } paragraph, G end of file), lets you express complex edits in a few keystrokes, without ever reaching for a mouse. Even people who live in other editors use Vim keybindings inside them (Emacs has Evil mode, VS Code has a Vim plugin) because the grammar is that good.

An everyday analogy

Most editors are like writing with a pen: you can only ever write. Vim is like having a pen and a full set of editing tools, scissors, highlighter, ruler, always in hand, and a single button to switch between “writing” and “editing”. The brief awkwardness of remembering which mode you are in is the price for never having to move your hands to a mouse or arrow keys.

A worked example: the grammar of editing

The power is that commands compose like a language, verb + motion:

dw     delete to the next word
d$     delete to the end of the line
ci"    change the text inside the quotes
y5j    yank (copy) the next 5 lines
.      repeat the last change

Learn ten verbs and ten motions and you can express a hundred edits, which is why the Goto line tricks below (282G, vim +282 file) feel so natural once the pattern clicks.

How it connects

The truth revealed: Vim feels baffling for a week and then becomes invisible, because once editing is a language your fingers speak, you stop thinking about the editor and think only about the text.

Last edited · 6 revisions

Tags: #Computing