......
全部博文(52)
分类: LINUX
2012-06-25 20:13:59
根据个人习惯整理一下vi基本操作,作为工具查用(update step by step)
1. movement of cursor
h : move to the left l : move to the right
k : move to the up j : move to the down
w : move to the next word b: move to the previous word
gg : move to the head of the article G : move to the end of the article
2. copy & paste & delete
yy(dd) : copy(delete) the total line
nyy(ndd) : copy(delete) the n line from the line of cursor located
wy(dy) : copy(delete) the one word
p : paste
v..y(press v ,and then move cursor to the alphabet you want , and then press y) : copy the
alphabet between v and y
3. find
/liubbc : find key word liubbc from up to down
?liubbc : find key word liubbc from down to up
4. undo & redo
u : undo Ctrl+r : redo
5. insert
o : input your word from next line (chage command mode to edit mode)
6. jump to the defination of function and go back
ctrl+] : jump to the defination of function
ctrl+t : go back
7. text highlighting & no highlighting
move to the word and then press shift+*
input nohl in command mode
8. edit your .vimrc
there is a file named vimrc in /etc, and it is a publicated conf file to all users.
set nu : show line number
syntax enable : text highlighting
autocmd : rember the location before
set tabstop=4 : tab == 4*space
9. edit two more files at the same time
a)vi xxx.c yyy.c
b):n edit next file :N edit file last file
c):files list all files in the vim