Configuration
Vim $HOME/.VIMRC
Syntax on# syntax highlighting
Set nocompatible# Remove VI consistency mode
Set number# display line numbers
Set history=50# setting command History bar number
Set autoindent# Auto Align
Set smartindent# Smart Alignment
Set tabstop=4# setting Tab key to 4 spaces
Set shiftwidth=4# use 4 spaces when interlaced between rows
Use
List of common commands
Move cursor |
Hjkl |
Front lower right Upper |
C+f,c+b |
Move one page up or down |
0,$ |
Move to the front and last of a line |
G,ng,gg |
Move to last, nth, row |
N |
Move n rows down |
Search replacement |
/word,?word |
Search down, up |
N,n |
Repeat down and up |
: n1,n2s/w1/w2/g |
Replace the W1 of the n1-n2 between the rows as W2 |
: 1, $s/w1/w2/g |
Replace All |
Copy, paste, delete |
X,x |
Remove one character backwards and forwards |
Nx |
Remove n characters backwards |
Dd,ndd |
Delete Row, row n |
Yy,nyy |
Copy one row, n rows |
P,p |
Paste Next and previous line |
U |
Restore the previous action |
C-r |
Repeat a previous action |
General mode into edit mode |
I,i |
Insert |
A,a |
Increase |
O,o |
New lines |
R,r |
Substitution mode |
[ESC] |
Exit edit mode |
General mode to command mode |
: w,:q,:wq,:q!,:x |
Save, exit |
: w filename |
Save As |
: R filename |
Read into the current document |
:! Command |
Execute command |
: Set Nu |
Show line Numbers |
: Set Nonu |
Do not display line numbers |
Brackets Match%
Introduction to Vim