全部博文(237)
分类: LINUX
2009-02-03 21:01:08
vim使用
tab设定:
set tabstop=4
set softtabstop=4
set shiftwidth=4
other setting:
set number | set nonumber #set line number
常用命令:
整理自vimtutor
ctr-O #go back
ctr-I #go forward
:s/regex/replace/gic #substitute on current line. g - replace all. i - ignore case. c - confirm
:1,10s/regex/replace/ #substitute from line 1~10
:%s/regex/replace/ #substitute whole file
:!pwd #execute external command
:w FILENAME #write the file to FILENAME
:r FILE #append FILE content at cursor
:r !ls #execute command and append output at cursor
% #find match ) ] }
10G #go to line 10
R #replace mode
yw #copy a word
y$ #copy until line
v #visual mode
v->select->:w PART #save part that is selected
:set xxx #set some function
:set ic #ignore case when search
:set noic
/regex\c #ignore case for this time
:set hls #highlight search
:set nohls
ctrl+w -> j|k #jump up or down to another window
:help or F1 #get help
:help w
:help user-manual
word completion using ctrl+D & TAB
:set nocp #make sure vim is not in compatible
:!l(press ctrl+D or TAB)
:ed(press ctrl+D or TAB)
:help .(press ctrl+D)
vim as python editor
add auto complete in vim for python
au Syntax python set omnifunc=pythoncomplete#Complete
au Syntax python set completefunc=pythoncomplete#Complete