At some point, every engineer or researcher needs to edit files directly from the terminal.

Vim is a fast text editor designed for efficient keyboard-driven workflows. Learning Vim improves speed, focus, and productivity, especially when working on remote servers, configuring systems, writing code, or handling quick edits without leaving the command line.

Below is a concise and practical Vim cheat sheet covering the most useful commands for navigation, editing, searching, file management, and efficient terminal-based development.

Vim is a modal text editor with distinct modes for different tasks.

Understanding these modes is key to using Vim effectively:

  • Normal (default): For navigation, editing commands, and text manipulation.

  • Insert: For typing and inserting text.

  • Visual: For selecting text blocks.

  • Command-line: For executing commands.

💡 Vim is powerful, but I use it only for quick editing. If you are starting your career, it is wiser to focus on deeper skills than perfecting Vim/Neovim.

Life is wonderful! Go outside, enjoy it, and be happier.

Start with Vim Tutor

For anyone completely new to Vim, the best place to start is Vim Tutor. It’s designed to be completed in about 30 minutes. By the time you’re done, you’ll know how to navigate, insert, delete, and save text.

To launch the tutor, just type this command in your terminal:

vimtutor

Vim basic operations

A few essential commands to get you started.

Open a file in Vim

vim <filename>

Basic operations

:h Open the help documentation

:w Save changes

:wq Save and quit

:q! Quit without saving changes

Vim modes and movement

Insert mode

These commands are used from Normal mode to enter Insert mode.

i Insert before the cursor

I Insert at the beginning of the line

a Append after the cursor

A Append at the end of the line

o New line and insert

O New line above and insert

Basic motions

Navigate your text quickly and efficiently.

h Move left

j Move down

k Up

l Right

0 Move to the start of the line

$ Move to the end of the line

^ Move to the first non-blank character of the line

gg Go to the first line of the file

G Go to the last line of the file

5G Go to line 5

Word motions

Move between words and characters.

w Move to the beginning of the next word

b Move to the beginning of the previous word

e Move to the end of the current or next word

ge Move to the end of the previous word

% Jump between matching parentheses, braces, and brackets

Vim editing and deleting

Deleting

Delete text with these powerful commands.

x Delete the character under the cursor

dd Delete the current line

dw Delete from the cursor to the end of the word

D Delete from the cursor to the end of the line

Changing

Change commands delete and then put you into Insert mode.

r Replace a single character

cw Change the current word

C Change to the end of the line

cc Change the entire line

Undo, redo, and repeating

Manage your edits with these essential commands.

u Undo the last change

Ctrl+r Redo the last undo

. Repeat the last change or command

Copy, cut, and paste

These operations are often referred to as yanking (copying), deleting (cutting), and pasting.

yy Copy the current line

yw Copy the current word

p Paste after the cursor

P Paste before the cursor

Vim visual mode

Use visual mode for selecting and operating on a block of text.

v Start character-wise visual selection

V Start line-wise visual selection

Ctrl+v Start block-wise visual selection

y Copy the selected text

d Delete the selected text

Vim searching and replacing

Find and replace text with power.

/word Search forward

?word Search backward

n Go to the next match

N Go to the previous match

* Search for the word under the cursor

# Search backwards for the word under the cursor

:%s/old/new/g Find and replace all

:%s/old/new/gc Find and replace all with confirmation

Vim file navigation

Vim has a built-in file explorer called Netrw to navigate your project without leaving the editor.

Open the file explorer

:Explore Open in the current window

:Lexplore Open in a new horizontal split (left)

:Vexplore Open in a new vertical split

Enter Open a directory or file

- Go up to the parent directory

u Go back to the previous directory in history

mb Bookmark the current directory

gb Jump to a bookmarked directory

Vim window management

Split your screen to work on multiple files or sections of the same file.

:split Horizontally split the window

:vsplit Vertically split the window

Ctrl-w h Move to the window to the left

Ctrl-w j Move to the window below

Ctrl-w k Move to the window above

Ctrl-w l Move to the window to the right

Ctrl-w q Close the current split

This is just the beginning

We’ve demystified some essential Vim shortcuts, giving you the confidence to navigate, search, and edit files efficiently.

The only thing left to do now is practice, practice, and practice.

This is just the beginning of your journey. May the Force be with you!