VIM 笔记

Moving

h
j
k
l

Exiting

:q
:wq
:q!

Deletion

x
dw
de
d$

d2w

Insert

i
A

Using count for a motion

2w
3e
0 ^

Operating on lines

dd
2dd

Undo

u	undo the last command
U	to fix a whole line
Ctrl+R	undo the undo's

Put Command

p

Replace

rx

Change Opration

ce +correct word
cw
c$

Cursor location and file status

Ctrl+G
gg
G
line number + G

Search command

Ctrl+O  go back to where you came from
Ctrl+I	goes forward
%

The substitute command

:s/old/new	the first occurrence of "old" in the line
:s/old/new/g	all occurrence of "old" in the line
:#,#s/old/new/g
:%s/old/new/g	the whole file
:%s/old/new/gc	ask for confirmation

Execute an external command

:!

Writing Files

:w TEST
v	:w TEST
v	d
r TEST
r !dir	read the output the dir command and puts it below the cursor position

Open Command

o	open a line below the cursor
O	open a line above the cursor

Append Command

a	append text AFTER the cursor
A	append text AFTER the line
i	insert text at the cursor position

Repace

R replace <ESC>

Copy and Paste

v	y	p

Set Option

:set ic		ignore case
:set is		show partial matches for a search pharses
:set hls	highlight all matching phrases

HELP

<F1>
:help

Ctrl-W
:q

:help w
:help 

Vimrc

:edit ~/.vimrc
:e ~/.vimrc

Completion

:set nocp	not use compatoble mode
:e Ctrl+D	<TAB>
Ctrl+W
posted @ 2019-02-20 21:29  隔壁老王python  阅读(67)  评论(0编辑  收藏