Fundamentals 9 min read

Master Vim: Essential Keybindings for Efficient Editing

This guide presents a comprehensive collection of Vim keybindings, illustrated with classic, beginner, advanced, and enhanced versions, and explains how to navigate, edit, search, and manage files using commands for movement, insertion, visual selection, and more, helping users master efficient text editing.

Liangxu Linux
Liangxu Linux
Liangxu Linux
Master Vim: Essential Keybindings for Efficient Editing

Classic Vim Keybinding Layouts

The article begins with a visual overview of the most widely used Vim keybinding charts, offering both English and Chinese versions. These classic layouts combine a series of introductory tutorial maps that cover different editing modes.

Different Versions for Various Skill Levels

Four progressive versions are provided:

Beginner version – a basic set of commands for new users.

Advanced version – adds more sophisticated shortcuts.

Enhanced (modern) version – a newer, richer set of mappings.

Text‑only version – a plain‑text list for those who prefer reading commands.

Each version is illustrated with an image of the corresponding keymap.

Moving the Cursor

By character, word, and token

h – move left
j – move down
k – move up
l – move right

Numeric prefixes repeat the motion (e.g., 5j moves down five lines).

b – jump to the beginning of a word
B – jump to the beginning of a token
w – jump to the start of the next word
W – jump to the start of the next token
e – jump to the end of a word
E – jump to the end of a token

Using B ignores spaces, so it jumps to the start of the whole token.

Line‑wise Movement

0 – go to the beginning of the line
$ – go to the end of the line
^ – jump to the first non‑blank character
# – go to a specific line number (replace # with the number)

Screen‑wise Navigation

Ctrl+b – scroll back one full screen
Ctrl+f – scroll forward one full screen
Ctrl+d – scroll down half a screen
Ctrl+u – scroll up half a screen
Ctrl+e – move down one line without moving the cursor
Ctrl+y – move up one line without moving the cursor
Ctrl+o – jump backward in the jump list
Ctrl+i – jump forward in the jump list
H – move cursor to the top of the screen
M – move cursor to the middle of the screen
L – move cursor to the bottom of the screen

Inserting Text

i – enter insert mode before the cursor
I – insert at the beginning of the line
a – enter insert mode after the cursor
a – insert after the cursor
A – append at the end of the line
o – open a new line below the current one
O – open a new line above the current one
ea – insert after the end of a word
Esc – return to normal (command) mode
:- – switch to command‑line mode

Vim starts in normal mode, allowing navigation and editing. Press Esc to return to normal mode from insert mode.

Editing Text

r – replace a single character
cc – replace an entire line (deletes it and enters insert mode)
C / c$ – replace from the cursor to the end of the line
cw – change to the end of the current word
s – delete the character under the cursor and enter insert mode
J – join the next line to the current line with a space
gJ – join the next line without inserting a space
u – undo the last change
Ctrl+r – redo the undone change
. – repeat the last command

Cut, Copy, and Paste

yy – yank (copy) the current line
#yy – yank a specific number of lines
dd – delete (cut) the current line
#dd – delete a specific number of lines
p – paste after the cursor
P – paste before the cursor

Searching Within a File

* – jump to the next occurrence of the word under the cursor
# – jump to the previous occurrence of the word under the cursor
/pattern – search forward for a pattern
?pattern – search backward for a pattern
n – repeat the search in the same direction
N – repeat the search in the opposite direction

Saving and Exiting

:w – write (save) the file without closing
:wq – write and quit
:q – quit without saving
:q! – force quit without saving changes
Shift+zz – save and quit
:w new_file_name – save as a new file and continue editing the original
:sav – save as a new file and continue editing the copy
:w! sudo tee% – write the file with sudo privileges using tee

Visual (Selection) Mode

Beyond normal and insert modes, Vim offers visual mode for selecting text. There are three visual sub‑modes: v – character‑wise selection V – line‑wise selection Ctrl+v – block‑wise (column) selection

After entering a visual mode, use navigation keys to expand the selection.

o – move to the opposite end of the selection
aw – select a word
ab – select a block surrounded by ()
aB – select a block surrounded by {}
at – select a block surrounded by <>

Visual Mode Commands

Once text is selected, the following commands act on the selection:

y – yank (copy) the selected text
d – delete (cut) the selected text
p – paste after the cursor
u – change the selected text to lowercase
U – change the selected text to uppercase
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Text EditingproductivityVimkeyboard shortcuts
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.