我最近完全切换到Vim的所有我的Python / Django开发。它花了我很多时间来定制它今天的点,和上帝知道是多么困难,我找到关于最好的vim插件适合Python / Django开发的帮助。
我决定提出这个问题,所以像我这样的人可以直接从您的经验中受益:
你已经构建了完美的Python / Djangoish Vim编辑器?请为我们描述它(插件,脚本,自定义.vimrc,colorschemes ..etc)。
谢谢
我的配置
好的,这是我自己的配置。实际上我选择创建一个简单的Vim配置,所以我可以掌握少量的插件,我选择安装,而不是做一个大堆的插件,我永远不会掌握或使用。这是我使用最多的插件的列表:
> NERDTree用于文件管理,
> SnipMate这是一个实现TextMate的片段功能,
>代码完成由Omnicompletion处理,默认情况下在Vim中,
> Pydoc将Python文档集成到Vim中,
> TagList用于源代码浏览,在大文件中非常有用。
> Pyflakes脚本来突出显示Python代码,并带有警告
我已经在$ HOME / .vim / ftplugin /包含这个脚本创建了一个python.vim文件,所以我可以运行python代码从Vim只是通过运行Shift e:
" Execute file being edited with <Shift> + e: map <buffer> <S-e> :w<CR>:!/usr/bin/env python % <CR>
我还收集了一些有用的.vimrc自定义:
set nocompatible " use vim defaults set number " show line numbers colorscheme desert set tags=tags;$HOME/.vim/tags/ "recursively searches directory for 'tags' file set expandtab " tabs are converted to spac set tabstop=4 " numbers of spaces of tab character set shiftwidth=4 " numbers of spaces to (auto)indent set showcmd " display incomplete commands set hlsearch " highlight searches set incsearch " do incremental searching set ruler " show the cursor position all the time set numberwidth=4 " line numbering takes up 5 spaces set ignorecase " ignore case when searching set nowrap " stop lines from wrapping filetype plugin indent on " turn on the indent plugins Syntax on " Syntax highlighing " TagList Plugin Configuration let Tlist_Ctags_Cmd='/usr/bin/ctags' " point taglist to ctags let Tlist_GainFocus_On_ToggleOpen = 1 " Focus on the taglist when its toggled let Tlist_Close_On_Select = 1 " Close when something's selected let Tlist_Use_Right_Window = 1 " Project uses the left window let Tlist_File_Fold_Auto_Close = 1 " Close folds for inactive files " Omnicompletion functions 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 au FileType py set expandtab au FileType py set foldmethod=indent map <F2> :prevIoUs<CR> " map F2 to open prevIoUs buffer map <F3> :next<CR> " map F3 to open next buffer map <F4> :NERDTreeToggle<CR> " map F4 to open NERDTree map <F5> :TlistToggle<CR> " map F5 to toggle the Tag Listing map <silent><C-Left> <C-T> " taglist - map Ctrl-LeftArrow to jump to the method/property under your cursor map <silent><C-Right> <C-]> " taglist - map Ctrl-RhitArrow to jump back to your source code map <silent><A-Right> :tabnext<CR> " map Alt-RightArrow to jump to the next tab map <silent><A-Left> :tabprevIoUs<CR> " map Alt-LeftArrow to jump to the prevIoUs tab
我真的没有太多的Django具体的mods,虽然我给了jinja2语法比django模板语法更高的优先级。
对于Python具体:
>对于Python语法检查我使用PyFlakes与高亮SpellBad ctermbg = darkred
>有时(很少)我需要自动完成,在这种情况下,我使用Eclim
>其余的,默认东西。标签大小4,软标签等…
Vim设置:
> 256颜色方案desert256
if ((&term == 'screen') || (&term == 'screen-bce') || (&term == 'xterm')) set t_Co=256 set t_Sb=^[[4%dm set t_Sf=^[[3%dm colo desert256 endif
>很多标签(tabe,tabn)>很多分裂(垂直和水平)