level 09

File & Buffer Navigation

Move between files and buffers, save, and quit.

Real work spans files, not one. Vim doesn’t think in tabs the way most editors do; it thinks in buffers, and the distinction trips people up for about a day before it clicks and never bothers them again. Get the model straight and hopping across a codebase stops being a chore.

Buffers, Windows, Tabs

  • A buffer is an open file (it stays in memory even when not visible).
  • A window is a viewport onto a buffer.
  • A tab is a layout of windows.
:bnext  :bprev  → cycle buffers
Ctrl+^          → toggle the two most recent buffers
:ls             → list open buffers
:b {name}       → jump to a buffer by name

Splits

:sp  :vsp       → horizontal / vertical split
Ctrl+w h/j/k/l  → move between windows
Ctrl+w w        → cycle windows
Ctrl+w q        → close the current window

Saving & Quitting

:w  :q  :wq  :q!   → save, quit, save+quit, quit without saving
ZZ  ZQ            → save+quit / quit shortcuts

Buffers, splits, and :w/:q need a real Vim session with multiple files, so they can’t run in the single embedded editor below. Most Vim and Neovim users also add a fuzzy finder — fzf.vim or Telescope.nvim — to jump to files by name instantly. The exercise here practices the in-file navigation that makes moving within a buffer just as fast.

Fast in-file navigation

  1. Press G to jump to the last line, then gg to return to the top.
  2. Press 4G to jump to API_KEY, then zz to center it.
  3. Search /TIMEOUT and Enter to jump straight to that constant.
  4. Put the cursor on DB_HOST and press * to find its other uses.
normalpress i to type · hjkl to move

goal Reach any line quickly with gg, G, counts, and centering.

Edit, then keep moving

  1. Jump to the listen line with /listen and Enter.
  2. Change the port from 3000 to 8080 with ciw.
  3. Press gg to return to the top.
  4. On the app.use line, press o to open a line below and add app.use(logger);.
normalpress i to type · hjkl to move

goal Combine navigation with edits — the everyday rhythm.