This will be updated if I have the time - backlog since 2019, left in old repo to forget.
Table of Contents
Mode
Normal Mode
This is the default mode. When you press Escape when in Insert mode you will exit to Normal mode. This is used in moving the cursur, deleting characters, words, lines etc. Operation like copy and paste is also done in this mode.
Insert Mode
You can switch to this mode using pressing i or Insert. This is the default behavior in a editors.
Basics
Key
Action
u
undo
ctrl+r
redo
d
delete line
Movement
You need to be in normal mode.
by Character
Refer table below to move by character.
Key
Action
h
left
j
down
k
up
l
right
Alternatively you can use the arrow button, but vim was built for efficiency.
by Words
Key
Action
Remarks (cursor is |)
w
move to the next word
first second |third
e
move to the end of the word
first second third|
b
move back a word
first |second third
Insert Mode
Key
Action
Remarks (cursor is |)
i
enter insert mode before your cursor
|word
a
enter insert mode after your cursor
w|ord
esc
go back to normal mode
Insert at Line Ends
No matter where you are in the line. When you these key you will Insert Mode and will be in the begiining of the line or at the end of theThe r operator is useful when you want to replace a single character with another character. It’s a nice way to quickly correct a typo without leaving normal mode.
The s operator is useful when you want to replace a single character with multiple characters via insert mode. line.
Key
Action
Remarks (cursor is |)
shift + i
enter insert mode at the beginning of a line
|a short line.
shift + a
enter insert mode at the end of a line
a short line.|
esc
go back to normal mode
Opening New Lines
Add a new line above or below your cursor and then enter insert mode on that line.
Key
Action
o
open a new line below the cursor
shift + o
open a new line above the cursor
Making Small Edits
Key
Action
x
delete the character under the cursor
s
delete the character under your cursor and enter insert mode.
r
replace the character under your cursor with the next character you type Example
The r operator is useful when you want to replace a single character with another character. It’s a nice way to quickly correct a typo without leaving normal mode.
The s operator is useful when you want to replace a single character with multiple characters via insert mode.
Essebtial Motions
Moving by Uppercase WORDs
The uppercase variants of the word motions.
Key
Action
shift + w
move to the next WORD
shift + e
move to the end of the WORD
shift + b
move back a WORD
Moving to Line Ends
Key
Action
0
move to the beginning of a line
$
move to the end of a line
_
move to the first word in a line
Find Motion
Quickly jump to a specific character within a line.
Key
Action
f char
move to the beginning of a line.
F char
move backward to the previous occurrence of {char} within the line.
;
repeat the last find motion.
df char (df,)
delete until comma
cf char (cf,)
change until until comma
Till Motion
Quickly jump till (just before) a specific character within a line.
Key
Action
t char
move forward till (just before) the next occurrence of {char} within the line.
T char
move backward till (just before) the previous occurrence of {char} within the line.
;
repeat the last find motion.
Operators
Operators are commands that perform actions on text. Operators must be followed by a motion to specify what part of the text to operate on.