After this lesson, you will be able to: Use vim well enough to edit config files on any server: open, insert, edit, save, quit, with zero panic.
vim is everywhere. nano is sometimes missing. Knowing the 10 vim commands that matter means you can edit any file on any server.
vim has two modes (really four, but two for this lesson). Normal mode: keys are COMMANDS (move, delete, search, save). Open in this mode. Insert mode: keys are TEXT (type to enter text). Press `i` to enter; `Esc` to leave back to Normal. Most beginner confusion is forgetting which mode they're in. Esc to be safe.
Memorise these. You can survive on a server with just these.
# Openvim file.txt # opens in Normal mode# Move (Normal mode)h j k l # left, down, up, right (or just use arrow keys)w # next wordb # previous word0 # start of line$ # end of lineG # end of filegg # start of file/foo # search for 'foo' (then n = next, N = previous)# Editi # enter Insert mode (before cursor)a # enter Insert mode (after cursor)o # new line below + Insert modeEsc # back to Normal modex # delete character under cursordd # delete current lineyy # yank (copy) current linep # paste below current lineu # undoCtrl-r # redo# Save and quit:w # save:q # quit:wq # save AND quit:q! # quit WITHOUT saving (force):x # alias for :wq
Scenario 1: 'I opened vim by accident, how do I get out?' → `Esc :q! Enter`. Scenario 2: 'I made a tiny edit and want to save.' → `Esc :wq Enter`. Both scenarios are 5 keystrokes. Drill them until they're muscle memory.
If you find yourself opening vim every day (sysadmin / SRE), invest a weekend in vimtutor (`vimtutor` command). If you write code daily, you might switch to VS Code with the Vim extension, best of both worlds. Otherwise, the 10 commands above cover 95% of server work.
Pick the exact sequence.
Sign in and purchase access to unlock this lesson.