VI Improved
or "Using VIM Without Killing Yourself"
Why VIM?
-
21 years of continuous development
-
Over 4,500 plugins available to date
The Basics
-
Modes
- Commands
-
Movement
-
Editing
-
Searching
-
Windows
-
Configuration
Modes
Normal
Default behavior, used for navigation and manipulation of text.
Insert
Used for inserting new text. "Normal" mode commands are also available in "Insert" mode through the use of meta keys.
Visual
Used for navigation and manipulation of text selections. Most "Normal" mode commands are available in "Visual" mode.
Commands
Introducing the Colon
Open
:o <filename>
Write
:w <filename>
Quit
:q
Help
:help
Movement
h => left
j => down
k => up
l => right
Movement
Document Level
Page Down
<ctrl>+f
Page Up
<ctrl>+b
Jump to Top
G
Jump to Bottom
gg
Jump to Line
<line number>G
Movement
Screen Level
Jump to Top of Screen
H
Jump to Middle of Screen
M
Jump to Bottom of Screen
L
Movement
Line Level
End of Word
e
Beginning of Word
b
End of Line
$
Beginning of Line
0
Movement
Miscellaneous
Jump to Closing Character
%
Undo Jump
``
Editing
Adding Data
Insert
i
Append
a
Append to Line
A
New Line
o
Editing
Replacing Data
Replace Character Under Cursor
r
Replace Word
cw
Replace Until Escape is Pressed
R
Editing
Deleting Data
Delete Character Under Cursor
x
Delete Word Under Cursor
dw
Delete Line
dd
Delete From Cursor to End of File
dG
Editing
Visual Blocks
Selecting Characters
v
Selecting Lines
V
Selecting Columns
<ctrl>+v
Editing Multiple Lines
I
Searching
Find
Basic Search
/<query>
REGEX Search
/<regex query>
Search
Find and Replace
Replace First Instance
Replace First Instance
:s/<find>/<replace>
Replace All Instances on Line
:s/<find>/<replace>/g
Replace All Instances in File
:%s/<find>/<replace>/g
Windows
Split Windows
Split Vertically
:vsplit
Split Horizontally
:split
Resize Split Window
:<vertical> resize <columns>
Move to Split Window
<ctrl>+w <direction>
Windows
Tabs
New Tab
:tabnew
Next Tab
gt
Previous Tab
gT
Jump to Tab #
<tab number>gt
Configuration
~/.vimrc
Configuration
VIM
By Zachary Flower
VIM
- 669