Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1542767
  • 博文数量: 237
  • 博客积分: 5139
  • 博客等级: 大校
  • 技术积分: 2751
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-18 14:48
文章分类

全部博文(237)

文章存档

2016年(1)

2012年(4)

2011年(120)

2010年(36)

2009年(64)

2008年(12)

分类: 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

  •  download python completion vim script :Python Omni Completion
  •  put in ~/.vim/autoload or /usr/share/vim/addons/autoload
  •  add following 2 line to .vimrc

au Syntax python set omnifunc=pythoncomplete#Complete
au Syntax python set completefunc=pythoncomplete#Complete

  •  use ctrl+x, ctrl+o when writing python program
阅读(3071) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~