Tutorial

Vim Tutorial

A practical tutorial on Vim, from modes and motions to the editing habits that make the editor feel like an extension of your hands. Covers the modal model, text objects, registers and macros, buffers and windows, configuration, plugins, and the idioms that separate fluent users from survivors.

Tutorial·Difficulty: Intermediate·12 chapters·Updated Apr 20, 2026

Chapters

About this tutorial

A practical tour of Vim, from your first :q! to the editing habits that make the editor feel like an extension of your hands.

Who This Is For

  • Developers who know a terminal and want an editor that stops getting in the way
  • Engineers who already use Vim "a little" and want to stop fighting it
  • Anyone who has watched someone fluent in Vim and thought "I want that"

Contents

Fundamentals

  1. Introduction: What Vim is, installing it, surviving vimtutor, opening and saving your first file
  2. Modes: Normal, insert, visual, command-line, operator-pending, and the mental model that ties them together

Core Concepts

  1. Navigation: hjkl, word and line motions, screen motions, the jump list, gg and G
  2. Editing: Operators (d, c, y, p), counts, the dot command, undo and redo
  3. Text Objects: iw, aw, i", a(, i{, composing operators with motions and objects
  4. Search and Replace: /, ?, *, n, N, :substitute, :global, very-magic mode

Advanced

  1. Buffers, Windows, Tabs: :e, :b, :sp, :vsp, window navigation, tab pages
  2. Registers and Macros: Named registers, the system clipboard, q to record, @ to replay
  3. Configuration: .vimrc, :set, mappings, autocommands, the leader key

Ecosystem

  1. Plugins: Native packages, vim-plug, the handful of plugins worth installing, a brief Neovim and LSP note
  2. Advanced Techniques: Folds, marks in depth, quickfix and location lists, completion, terminal mode

Mastery

  1. Best Practices: Idioms, muscle-memory patterns, anti-patterns, knowing when to step out of Vim

How to Use This Tutorial

  1. Read sequentially for a complete learning path
  2. Type out the commands. Watching someone else use Vim teaches you nothing
  3. Keep a scratch file open while reading. Break it, reload it, try things

Quick Reference

Essential Commands

# Open and close
vim notes.md          # open a file
:w                    # save
:q                    # quit
:wq                   # save and quit
:q!                   # quit, discard changes

# Move (normal mode)
h j k l               # left down up right
w b e                 # next word, previous word, end of word
0 ^ $                 # start of line, first non-blank, end of line
gg G                  # top of file, bottom of file

# Edit
i a o                 # insert before, after, new line below
x dd yy p             # delete char, delete line, yank line, put
u <C-r>               # undo, redo
.                     # repeat last change

# Search
/pattern              # search forward
n N                   # next, previous match
:%s/old/new/g         # replace in whole file

Your First Session

vim scratch.txt
# press i to enter insert mode, type a few lines
# press <Esc> to return to normal mode
# type :w<Enter> to save
# type :q<Enter> to quit

Common Patterns

ciw            change inner word
ci"            change inside quotes
dap            delete a paragraph (and the blank line after)
>ap            indent a paragraph
gUiw           uppercase inner word
"+yy           yank line to system clipboard
:%s/foo/bar/gc replace with confirmation
qa...q  @a    record macro in register a, replay

Learning Path Suggestions

Survive your first week (roughly 4 hours)

  1. Chapter 01 and 02 for orientation and the modal model
  2. Chapter 03 for motions you will use every minute
  3. Chapter 04 for the operator mental model (d, c, y, p, .)
  4. Use Vim for a day with nothing else

Get fluent (roughly 8 hours)

  1. Chapter 05 on text objects (the grammar multiplier)
  2. Chapter 06 on search and substitute
  3. Chapter 07 on buffers and windows
  4. Chapter 08 on registers and macros

Make Vim yours (roughly 4 hours)

  1. Chapter 09 to write a lean .vimrc
  2. Chapter 10 to add a few plugins
  3. Chapter 12 to learn which habits to lean on

Why Vim?

  • Modal editing. Most of your time is not typing new text, it is moving and changing existing text. Vim optimises for that
  • Composable commands. d + motion, c + motion, y + motion. Learn a few operators and a few motions and you get their product for free
  • Everywhere. SSH into a box, and Vim is already there. Most IDEs have a Vim mode worth turning on
  • Longevity. Vim has been stable for decades. Skills transfer

Additional Resources

Vim Version

This tutorial is written for Vim 9+ and uses commands available in Vim 8.2 or later. Most examples apply equally to Neovim 0.9+, and differences are called out where they matter.