Vim+TmuxMaster

Hands-On Vim Guide

Master the world's most powerful text editor with our step-by-step guide

Normal Mode

The default mode in Vim. Here you navigate and manipulate text without inserting it.

Basic Movement

h Move left
j Move down
k Move up
l Move right

Word Movement

w Start of next word
e End of current word
b Start of previous word

Text Operations

dd Delete current line
yy Yank (copy) current line
p Paste after cursor
u Undo last action

Line Navigation

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

Live Example: Navigating a File

example.js
// Navigation example
function calculateTotal(items) {
  let total = 0;

  for (let i = 0; i < items.length; i++) {
    const item = items[i];
    total += item.price * item.quantity;
  }

  return total;
}

// Current cursor position is here

Insert Mode

In Insert mode, you can type text directly into your file. There are multiple ways to enter Insert mode.

Entering Insert Mode

i Insert at cursor position
I Insert at beginning of line
a Append after cursor
A Append at end of line
o Open line below
O Open line above

Exiting Insert Mode

Esc Return to Normal mode
Ctrl+C Alternative way to exit

Insert Mode Shortcuts

Ctrl+W Delete word before cursor
Ctrl+U Delete all text before cursor
Ctrl+N/P Word completion (next/previous)

Visual Mode

Visual mode allows you to select text before performing operations on it.

Entering Visual Mode

v Character-wise Visual mode
V Line-wise Visual mode
Ctrl+v Block-wise Visual mode

Visual Mode Navigation

Use normal mode movement keys:

hjkl Extend selection
o Move to other end of selection
Esc Exit Visual mode

Operations in Visual Mode

d Delete selected text
y Yank (copy) selected text
c Change selected text
>/< Indent/outdent selection

Block-wise Visual Mode

I Insert at beginning of selection
A Append at end of selection

Command Mode

Command mode allows you to execute powerful Ex commands, search, and replace operations.

Basic Commands

:w Save file
:q Quit
:wq Save and quit
:q! Force quit without saving

Search Operations

/pattern Search forward for pattern
?pattern Search backward for pattern
n Next search match
N Previous search match

Find and Replace

:%s/old/new/g Replace all occurrences in file
:%s/old/new/gc Replace with confirmation
:10,20s/old/new/g Replace between lines 10-20

Advanced Commands

:set number Show line numbers
:syntax on Enable syntax highlighting
:split filename Split window horizontally

Live Example: Search and Replace

config.js
const config = {
  apiUrl: 'http://dev-api.example.com/v1',
  timeout: 5000,
  retryCount: 3,
  logLevel: 'debug',
  environment: 'development',
  features: {
    darkMode: true,
    analytics: false,
    experimental: true
  }
};

// Replace all instances of 'development' with 'production'
// Command: :%s/development/production/g

Next Steps in Your Vim Journey

Recommended Resources

Practical Tips

  • Use vimtutor in your terminal for a guided tutorial
  • Start with a minimal .vimrc and add configurations as needed
  • Practice daily with small, focused exercises
  • Learn one new command or feature a day

Ready to take your terminal environment to the next level?

Continue to Tmux Guide →