Vim as Python IDE on windows

二 26th, 2012

一直在用python,也一直在用ActivePython,虽然感觉还行,但是总觉得不太爽。最近,看到网上大把的将VIM打造成python IDE的文章,就参考着将自己的GVIM也打造成一个靠谱的IDE,用起来真不错,嘿嘿!先看看成果,以后再详细写写配置步骤:

desk

实现的功能主要有:

  • 1.  基本设置
  • 2.  代码补全(omni-completion + pydiction
  • 3.  Ctags 
  • 4.  TagList
  • 5.  WinManager
  • 6.  cscope
  • 7.  MiniBufExplorer
  • 8.  Grep
  • 9.  VimPdb
  • 10. ropenvim
  • 11. pyflakes

我的_vimrc文件如下:

set nocompatible
source $VIMRUNTIME/vimrc_example.vim
source $VIMRUNTIME/mswin.vim
behave mswin

set diffexpr=MyDiff()
function MyDiff()
  let opt = '-a --binary '
  if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  let arg1 = v:fname_in
  if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  let arg2 = v:fname_new
  if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  let arg3 = v:fname_out
  if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  let eq = ''
  if $VIMRUNTIME =~ ' '
    if &sh =~ '\
      let cmd = '""' . $VIMRUNTIME . '\diff"'
      let eq = '"'
    else
      let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
    endif
  else
    let cmd = $VIMRUNTIME . '\diff'
  endif
  silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
endfunction

" 设置编码自动识别, 中文引号显示  
"set fileencodings=utf-8,cp936,big5,euc-jp,euc-kr,latin1,ucs-bom  
set fileencodings=utf-8,gbk  
set ambiwidth=double

"ColorScheme
colorscheme desert

"colorscheme pyte
"set encoding=utf-8
set formatoptions+=mM
set guifont=Courier_New:h11:cANSI

"set syn=cpp
set nu
set hlsearch
set tabstop=4
set cindent
set shiftwidth=4
set tags=E:\IDE\ctags58\tags
set helplang=cn
set autochdir
set backupcopy=no
filetype on
set history=40
set mouse=a
set ruler
set expandtab
set nowrap
set smartindent  
set smarttab
set expandtab
set softtabstop=4  
set shiftwidth=4  
set backspace=2
set textwidth=79  
set mouse=a

"自动补全  
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  代码补全
let g:pydiction_location = "E:\Program Files\Vim\vim73\ftplugin\complete-dict"


"Grep
nnoremap <silent> <F3> :Grep<CR>

"WinManager
let g:winManagerWindowLayout='FileExplorer|TagList'
nmap wm :WMToggle<cr>

let Tlist_Ctags_Cmd='ctags.exe'     "ctags的位置
let Tlist_Use_Right_Window=1    "taglist显示在窗口右侧
let Tlist_Auto_Open=1

map <F12>:!c:\Python27\python.exe %

"The NERD Tree
nmap nt :NERDTree<cr>
nmap ntt :NERDTreeToggle<cr>

"MiniBufExplorer
let g:miniBufExplMapWindowNavVim = 1 
let g:miniBufExplMapWindowNavArrows = 1 
let g:miniBufExplMapCTabSwitchBufs = 1 
let g:miniBufExplModSelTarget = 1

" Show TAB char and end space
" 我不喜欢 tab 和每行尾巴上的多余空格,如果文件里有,要记得告诉我
set listchars=tab:>-,trail:~
set list
syntax match Trail " +$"
highlight def link Trail Todo




除非注明,本站文章均为原创。本文基于 BY-NC-SA 协议进行授权,欢迎转载,演绎或用于商业目的,但是必须保留本文的署名 metaboy(包含链接).

本文链接地址: http://blog.wangyuxiong.com/archives/51591

订阅本站:http://www.wangyuxiong.com/feed

分类: 工具推荐         标签: , ,
目前还没有任何评论.

无觅相关文章插件,快速提升流量