EDIT
AT SPEED

// The editor that runs the internet.

MOUSE USERS ARE SLOW.

Every second spent reaching for the mouse is a second wasted. Vim's modal editing lets you keep your hands on the keyboard and edit at the speed of thought.

WHY VIM

Vim is everywhere. It's on every Linux system, every server, every container. Learning Vim once means you have a powerful editor everywhere you go.

HJKL YOUR WAY TO SPEED.

START LEARNING →

// The Vim Path

12 lessons. Complete Vim mastery.

LESSON 01

Introduction to Vim

What is Vim, modes, and why modal editing

Beginner
LESSON 02

Basic Navigation

Moving around with h,j,k,l and beyond

Beginner
LESSON 03

Insert Mode & Text Entry

Entering and exiting insert mode

Beginner
LESSON 04

Deleting & Changing

d, c, x and the vim grammar

Intermediate
LESSON 05

Yanking & Pasting

y, p and the Vim register system

Intermediate
LESSON 06

Searching & Replacing

/, s, :%s and regular expressions

Intermediate
LESSON 07

Visual Mode

v, V, Ctrl+v for block selection

Intermediate
LESSON 08

Macros & Automation

Recording and replaying commands with q

Advanced
LESSON 09

Windows & Splits

Editing multiple files with splits

Advanced
LESSON 10

Buffers & Tabs

Managing multiple files in Vim

Advanced
LESSON 11

Vim Configuration

.vimrc and essential settings

Advanced
LESSON 12

Plugins & Extensions

Extending Vim with plugins

Advanced

// Why Vim

Vim is the editor that runs the world's infrastructure. Every Linux server, every container, every terminal has Vim. Master it once and you have a superpower everywhere.

The investment: 2 weeks of practice. The payoff: 10x editing speed for the rest of your career.

What you'll master: Modal editing, navigation, text objects, macros, splits, and automation. By the end, you'll edit faster than you can think.

Quit the mouse. Save the world.

// Lesson 1: Introduction to Vim

×

What is Vim?

Vim (Vi IMproved) is a modal text editor. Unlike most editors where you just type, Vim has different modes for different tasks. This seems strange at first, but it's incredibly powerful.

The Three Main Modes

  • Normal mode: The default mode. Move around, delete, copy, etc.
  • Insert mode: Type text like a normal editor
  • Visual mode: Select text for operations

Switching Modes

i           # Enter Insert mode (before cursor)
a           # Enter Insert mode (after cursor)
Esc         # Return to Normal mode
v           # Enter Visual mode
V           # Enter Visual Line mode
Ctrl+v      # Enter Visual Block mode
:           # Enter Command mode

Why Modal Editing?

# Without modal editing:
Ctrl+c to copy
Ctrl+v to paste
Mouse to select
Click menu to save

# With Vim:
yy to yank
p to paste
Navigation keys to move
:w to save

# All without leaving the home row

// Knowledge Check

What is the default mode when Vim starts?

Hint: Not insert mode

What key returns you to Normal mode?

Hint: Esc

Show Answers

Answers

  1. normal
  2. escape

// Lesson 2: Basic Navigation

×

Navigation Keys

In Vim, you keep your hands on the home row. No reaching for arrow keys or mouse.

Essential Movement

h           # Left
j           # Down
k           # Up
l           # Right

w           # Word forward
b           # Word backward
e           # End of word

0           # Start of line
$           # End of line
^           # First non-blank character

gg          # First line of file
G           # Last line of file
:n          # Go to line n

Screen Movement

H           # High - first line on screen
M           # Middle - middle of screen
L           # Low - last line on screen

Ctrl+b      # Back one screen
Ctrl+f      # Forward one screen
Ctrl+d      # Down half screen
Ctrl+u      # Up half screen

zt          # Current line at top
zz          # Current line at middle
zb          # Current line at bottom

Finding Characters

f     # Find character forward
F     # Find character backward
t     # Till character (before)
T     # Till character (after)
;           # Repeat last f/F/t/T
,           # Repeat in opposite direction

// Knowledge Check

What key moves you down a line?

Hint: Not k

What command goes to the end of the file?

Hint: Capital G

Show Answers

Answers

  1. j
  2. G

// Lesson 3: Insert Mode & Text Entry

×

Entering Insert Mode

Once you know navigation, you need to know how to actually type text.

Insert Commands

i           # Insert before cursor
I           # Insert at beginning of line
a           # Append after cursor
A           # Append at end of line
o           # Open line below
O           # Open line above
s           # Substitute (delete char + insert)
S           # Substitute line (delete line + insert)
c           # Change (delete + insert)

Special Insert Commands

Ctrl+h      # Delete character before cursor (in insert)
Ctrl+w      # Delete word before cursor
Ctrl+u      # Delete to beginning of line

Ctrl+o      # Temporary Normal mode - one command then back
            # e.g., Ctrl+o $ goes to end of line, then back to insert

Ctrl+t      # Indent current line
Ctrl+d      # Un-indent current line

Exiting Insert Mode

Esc         # Go back to Normal mode
Ctrl+c      # Also exits (like Esc)
Ctrl+[      # Also exits (Alt+[)

// Knowledge Check

What command inserts at the end of the current line?

Hint: Capital A

What command opens a new line below?

Hint: Small o

Show Answers

Answers

  1. A
  2. o

// Lesson 4: Deleting & Changing

×

The Delete Commands

Deleting in Vim doesn't just delete - it cuts into the register for pasting.

Basic Deletes

x           # Delete character under cursor
X           # Delete character before cursor
d           # Delete operator (needs motion)
dd          # Delete entire line
D           # Delete to end of line

# With motions:
dw          # Delete word
d$          # Delete to end of line
d0          # Delete to beginning of line
dG          # Delete to end of file
dgg         # Delete to beginning of file

The Change Command

c           # Change operator (delete + enter insert)
cc          # Change entire line
C           # Change to end of line

cw           # Change word
c$           # Change to end of line

Vim Grammar

# Operator + Motion = Action
# operator {motion}

d{ motion }  # delete
c{ motion }  # change  
y{ motion }  # yank

# Examples:
dw   # delete word
de   # delete to end of word
dw   # delete word (from cursor to space)
d2w  # delete 2 words
d}   # delete to end of paragraph

// Knowledge Check

What does dd do?

Hint: Not delete character

What is the operator for change?

Hint: Not d

Show Answers

Answers

  1. delete line
  2. c

// Lesson 5: Yanking & Pasting

×

The Yank (Copy) Command

Yanking is Vim's copy command. It copies text into a register for later pasting.

Yank Commands

y           # Yank operator (needs motion)
yy          # Yank entire line
Y           # Yank to end of line (same as y$)

# With motions:
yw          # Yank word
y$          # Yank to end of line
y0          # Yank to beginning of line
yG          # Yank to end of file

Paste Commands

p           # Paste after cursor
P           # Paste before cursor

# Line operations:
dd          # Delete line (cuts it)
p           # Paste below
P           # Paste above

The Register System

"a          # Use register a
"b          # Use register b

# Yank to register a:
"ayy        # Yank line to register a
"ap         # Paste from register a

# Special registers:
""          # Default register (last yank/delete)
"0          # Yank register (only yanks)
"1          # Most recent delete

:reg        # Show all registers

// Knowledge Check

What command yanks (copies) text?

Hint: Like yank

What does p do in Vim?

Hint: After cursor

Show Answers

Answers

  1. y
  2. paste

// Lesson 6: Searching & Replacing

×

Searching in Normal Mode

Vim has powerful search built in.

Search Commands

/pattern     # Search forward for pattern
?pattern     # Search backward for pattern

n             # Next match (same direction)
N             # Next match (opposite direction)

# Search within current line:
f       # Find char forward
F       # Find char backward
t       # Till char (stop before)
T       # Till char (stop after)
;             # Repeat last f/F/t/T
,             # Repeat opposite

Find and Replace

:s/old/new/           # Replace first match on line
:s/old/new/g           # Replace all on line
:%s/old/new/           # Replace first match in file
:%s/old/new/g          # Replace all in file
:%s/old/new/gc         # Replace all with confirm

# Case sensitive by default
:set ignorecase       # Make searches case insensitive
:set noignorecase      # Back to case sensitive

Regular Expressions

.              # Any character
*              # Zero or more of previous
+              # One or more of previous
\w             # Word character
[abc]          # Any of a, b, or c
[^abc]         # Not a, b, or c
^              # Start of line
$              # End of line

// Knowledge Check

What searches forward in Vim?

Hint: Forward slash

What command replaces all matches in file?

Hint: With %s

Show Answers

Answers

  1. /
  2. :%s

// Lesson 7: Visual Mode

×

Selecting Text

Visual mode lets you select text for operations.

Visual Modes

v            # Visual mode (character-wise)
V            # Visual Line mode (line-wise)
Ctrl+v       # Visual Block mode (column-wise)

Visual Mode Operations

# After selecting:
d            # Delete selection
y            # Yank selection
c            # Change selection (delete + insert)
>            # Indent selection
<            # Un-indent selection
~            # Toggle case

# In Visual Line mode:
J            # Join selected lines
u            # Make lowercase
U            # Make uppercase

Visual Block Magic

# Select a column:
Ctrl+v       # Enter visual block
jjj          # Move down (select column)
I            # Insert before (in visual block mode)
type text    # Type what you want
Esc          # Exit - text appears in all lines!

// Knowledge Check

What selects by lines?

Hint: Capital V

What selects columns (vertical)?

Hint: Visual block

Show Answers

Answers

  1. V
  2. Ctrl+v

// Lesson 8: Macros & Automation

×

Recording Macros

Macros let you record a sequence of commands and replay them.

Basic Macro Usage

q   # Start recording to register (a-z)
...          # Do your commands
q            # Stop recording

# Play back:
@   # Play macro from register
@@            # Repeat last macro
10@ # Play macro 10 times

Example Macro

# Add quotes around each word on a line:
# Starting with: hello world test

qa            # Start recording to register a
b             # Move to beginning of word
i             # Insert mode
"             # Type quote
Esc           # Back to normal
e             # Move to end of word
a             # Append
"             # Type quote
Esc           # Back to normal
w             # Next word
q             # Stop recording

# Now apply to each word:
3@a           # Run macro 3 times
# Result: "hello" "world" "test"

Useful Macro Tips

:reg a        # See what's in register a
"ap           # Paste contents of register a

# Useful registers:
q             # q is good for temporary macros
a             # a-z for different macros
0             # yank register persists

// Knowledge Check

What starts recording a macro?

Hint: Then register name

What replays a macro?

Hint: @ then register

Show Answers

Answers

  1. q
  2. @

// Lesson 9: Windows & Splits

×

Split Your Screen

Vim can show multiple files or parts of the same file side by side.

Creating Splits

:sp file     # Split horizontally
:vsp file    # Split vertically
Ctrl+ws      # Split window horizontally
Ctrl+wv      # Split window vertically

# Or open file in split:
:sp filename
:vsp filename

Navigating Splits

Ctrl+w h     # Move to left window
Ctrl+w j     # Move to below window
Ctrl+w k     # Move to above window
Ctrl+w l     # Move to right window
Ctrl+w w     # Cycle through windows
Ctrl+w t     # Move to top-left window
Ctrl+w p     # Move to previous window

Window Commands

Ctrl+w =     # Equalize window sizes
Ctrl+w _     # Maximize height
Ctrl+w |     # Maximize width
Ctrl+w +     # Increase height
Ctrl+w -     # Decrease height

:close       # Close current window
:only        # Keep only current window

// Knowledge Check

What splits vertically?

Hint: :vsp

What cycles through windows?

Hint: w w

Show Answers

Answers

  1. :vsp
  2. Ctrl+w w

// Lesson 10: Buffers & Tabs

×

Understanding Buffers

Every file you open goes into a buffer. Windows show buffers. Tabs organize windows.

Buffer Commands

:e file      # Edit file (opens in current window)
:badd file   # Add file to buffer list
:ls          # List all buffers
:bn          # Next buffer
:bp          # Previous buffer
:bf          # First buffer
:bl          # Last buffer
:b n         # Go to buffer n
:bd          # Delete buffer (close file)

Tab Commands

:tabnew           # New tab
:tabe file       # Open file in new tab
:tabn            # Next tab
:tabp            # Previous tab
:tabfirst        # First tab
:tablast         # Last tab
gt               # Next tab (normal mode)
gT               # Previous tab (normal mode)
{n}gt            # Go to tab n

# In tabs:
:tabclose        # Close tab
:tabdo cmd       # Run command in all tabs

Buffer vs Tab vs Window

Buffer: The file in memory (hidden)
Window: A view onto a buffer
Tab: A collection of windows

// Knowledge Check

What shows all open files?

Hint: List buffers

What command creates a new tab?

Hint: :tabnew

Show Answers

Answers

  1. :ls
  2. :tabnew

// Lesson 11: Vim Configuration

×

The .vimrc File

Your .vimrc is where you configure Vim to your liking.

Essential Settings

" ~/.vimrc

" Basics
set nocompatible        " Use Vim settings, not Vi
set number              " Show line numbers
set relativenumber      " Relative line numbers
set cursorline          " Highlight current line
set showmode            " Show current mode

" Search
set ignorecase          " Case insensitive search
set smartcase           " Case sensitive if caps used
set incsearch           " Incremental search
set hlsearch            " Highlight searches

" Indentation
set expandtab           " Use spaces instead of tabs
set tabstop=4           " Tab = 4 spaces
set shiftwidth=4        " Auto-indent = 4 spaces
set autoindent          " Keep indent on new line
set smartindent         " Smart auto-indent

Useful Mappings

" Map leader to space
let mapleader = " "

" Better window navigation
nnoremap h h
nnoremap j j
nnoremap k k
nnoremap l l

" Move lines up/down
vnoremap J :m '>+1gv=gv
vnoremap K :m '<-2gv=gv

Plugins with vim-plug

" Install vim-plug first
" https://github.com/junegunn/vim-plug

call plug#begin('~/.vim/plugged')

Plug 'tpope/vim-surround'
Plug 'preservim/nerdtree'
Plug 'vim-airline/vim-airline'

call plug#end()

// Knowledge Check

What file stores Vim configuration?

Hint: Dot file

What setting shows line numbers?

Hint: set ???

Show Answers

Answers

  1. .vimrc
  2. number

// Lesson 12: Plugins & Extensions

×

Extending Vim

Vim's plugin ecosystem makes it infinitely extensible.

Plugin Managers

# vim-plug (popular)
call plug#begin('~/.vim/plugged')
Plug 'author/plugin'
call plug#end()

# Then run:
:PlugInstall

# lazy.nvim (modern, for Neovim)
# packer.nvim (Neovim)
# Vundle (older but works)

Essential Plugins

" File navigation
Plug 'preservim/nerdtree'        " File tree explorer
Plug 'junegunn/fzf.vim'          " Fuzzy finder

" Text objects
Plug 'tpope/vim-surround'       " cs"', "ysiw", etc.
Plug 'vim-scripts/ReplaceWithRegister'

" Completion
Plug 'neoclide/coc.nvim'        " Language server

" Interface
Plug 'vim-airline/vim-airline'   " Status bar
Plug 'itchyny/lightline.vim'      " Alternative status bar

vim-surround Examples

" Change surrounding
cs"'           " Change " to '
cs(            " Change ( to (
cs[{           " Change { to [

" Add surrounding
ysiw"          " Add " around word
ysiw(          " Add ( around word
ys$            " Add to end of line

" Delete surrounding
ds"            " Delete " around text
ds(            " Delete ( around text

// Knowledge Check

What plugin manages surrounding characters?

Hint: vim-surround

What is a popular plugin manager?

Hint: Run :PlugInstall

Show Answers

Answers

  1. surround
  2. vim-plug

// Tools & References

📖 Vim Documentation

Official Vim documentation

vimhelp.org

📚 Vim Tutorial

Interactive Vim tutorial

openvim.com

🎮 Vim Golf

Learn Vim through puzzles

vimgolf.com

📋 Vim Cheat Sheet

Quick reference for commands

vim.rtorr.com

⚡ Vim Awesome

Plugin directory

vimawesome.com

📜 Practical Vim

Book: Edit Text at the Speed of Thought

pragprog.com