Vim as Python IDE on windows(待补全)
时间:2010-09-07 来源:DDL
从Vim的网站下载vim,下Self-installing executable的版本。
编辑配置文件_vimrc
拷贝vimrc_example里面的东东到_vimrc
去掉_vimrc里面的source $VIMRUNTIME/vimrc_example.vim
设置中文支持
" 设置编码自动识别, 中文引号显示
"set fileencodings=utf-8,cp936,big5,euc-jp,euc-kr,latin1,ucs-bom
set fileencodings=utf-8,gbk
set ambiwidth=double
设置ColorScheme
"ColorScheme
colorscheme desert
设置tab插入空格,缩进,删除键删除缩进,页面文字宽度
" 允许退格键删除和tab操作
set smartindent
set smarttab
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
set backspace=2
set textwidth=79
启用鼠标,启用行号
" 启用鼠标
set mouse=a
" 启用行号
set nu
启用omni-completion的代码补全功能 ,顺便把其他语言的支持也加上了。现在按Ctrl-X,Ctrl-O可以补全代码
代码"自动补全
filetype plugin indent on
set completeopt=longest,menu
"自动补全命令时候使用菜单式匹配列表
set wildmenu
autocmd FileType ruby,eruby set omnifunc=rubycomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
autocmd FileType xml set omnifunc=xmlcomplete#CompleteTags
autocmd FileType java set omnifunc=javacomplete#Complet
启用pydiction,更丰富的的代码补全功能,按tab补全代码
pydiction http://www.vim.org/scripts/script.php?script_id=850
"Pydiction
let g:pydiction_location = 'C:\Program Files\Vim\vim73\ftplugin\complete-dict
启用Ctags,分析源代码
Ctags http://ctags.sourceforge.net/
TagList ,配合Ctags可以高效的查看源代码,http://www.vim.org/scripts/script.php?script_id=273
"TagList
let Tlist_Show_One_File=1
let Tlist_Exit_OnlyWindow=1
启用WinManager 同时显示FileExplorer和TagList
WinManager http://www.vim.org/scripts/script.php?script_id=95
"WinManager
let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr
启用Cscope ,更高级的分析源代码,支持反向查找
Cscope http://cscope.sourceforge.net/
windows下的可用版本http://sourceforge.net/projects/mslk/
"cscope show in quickfix
set cscopequickfix=s-,c-,d-,i-,t-,e-
代码
nmap <C-_>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <C-_>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <C-_>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <C-_>d :cs find d <C-R>=expand("<cword>")<CR><CR
启用MiniBufExplorer,管理vim的buffer(缓冲区),快速的在多个同时编辑的文件间切换。
MiniBufExplorer http://www.vim.org/scripts/script.php?script_id=159
"MiniBufExplorer
let g:miniBufExplMapCTabSwitchBufs = 1
let g:miniBufExplMapWindowNavVim = 1
let g:miniBufExplMapWindowNavArrows = 1
启用Grep,在工程中查找
Grep http://www.vim.org/scripts/script.php?script_id=31
Grep for windows http://gnuwin32.sourceforge.net/packages/grep.htm
"Grap
nnoremap <silent> <F3> :Grep<CR>
启用VimPdb ,可以调试Python程序
VimPdb http://www.vim.org/scripts/script.php?script_id=2043
http://code.google.com/p/vimpdb/
启用ropevim ,重构Python程序
ropevim http://rope.sourceforge.net/ropevim.html
Python语法检查
pyflakes http://www.vim.org/scripts/script.php?script_id=2441
还没有全部配置好,但大部分功能都有了,以后慢慢更新。
参考文档:
VIM as Python IDE
参考众多,不一一列举了。