vim配置python IDE

1.文法高亮
为了能在Vim中支持Python文法须要用到插件python.vim,该插件默认位于<Vim安装目录>/<$VIMRUNTIME>/syntax/下,若是你在该路径下没有找到这个插件,须要到python.vim : Enhanced version of the python syntax highlighting script下载。而后为了能让Vim识别Python文法须要在vimrc中添加:
set filetype=pythonau BufNewFile,BufRead *.py,*.pyw setf python
2.缩进
在vimrc中添加以下缩进相关的代码:
set autoindent " same level indentset smartindent " next level indentset expandtabphp

set tabstop=4python

set shiftwidth=4vim

set softtabstop=4windows

.树形目录
官网:http://www.vim.org/scripts/script.php?script_id=1658
"nerdtree
map <F3> :NERDTreeToggle<CR>app

 

4.项目视图
官网:http://www.vim.org/scripts/script.php?script_id=273
ctags http://ctags.sourceforge.net/
"taglist
let Tlist_Ctags_Cmd = 'D:\python_tool\ctags58\ctags.exe' "注意下载ctags
let g:ctags_statusline=1
let generate_tags=1
let Tlist_Use_Horiz_Window=0
map <F4> : TlistToggle<cr>
let Tlist_Show_One_File=1
let Tlist_Use_Right_Window=1
let Tlist_Compact_Format=1
let Tlist_Exit_OnlyWindow=1
let Tlist_GainFocus_On_toggleOpen=1
let Tlist_File_Fold_Auto_Close=1工具

 

5.语法检查spa

官网:http://www.vim.org/scripts/script.php?script_id=2441
“pyflakes
.net


6.帮助文档
"pydoc
let g:pydoc_cmd = 'D:\python_tool\pydoc.py'
用法
Pydoc <keyword> 例如 Pydoc re.compile
* PydocSearch <keyword> 在windows下有问题
*当光标在某个词上时,按下’K’插件


7.代码补全
官网:http://www.vim.org/scripts/script.php?script_id=850
"自动补全代码
"pydiction 1.2 python auto complete
filetype plugin on
let g:pydiction_location = 'D:\python_tool\complete-dict'
"defalut g:pydiction_menu_height == 15
"let g:pydiction_menu_height = 20orm

个人_vimrc文件:
set nocompatible "去掉讨厌的有关vi一致性模式,避免之前版本的一些bug和局限
set magic " 设置魔术
set ru "标尺信息
set ai
set sw=4 "Tab 宽度为4 个字符
set nu " 显示行号
set ts=4
set dy=lastline "显示最多行,不用@@
"以上是缩进相关
set backspace=indent,eol,start
colo lucius "配色方案
sy on
set go= "无菜单、工具栏
set nobackup "从不备份
set hlsearch "搜索逐字符高亮
set showmatch " 匹配括号高亮的时间(单位是十分之一秒)
"tab mappings
"自动补全
:inoremap ( ()<ESC>i
:inoremap ) <c-r>=ClosePair(')')<CR>
:inoremap < <><ESC>i
:inoremap > <c-r>=ClosePair('>')<CR>
:inoremap { {<CR>}<ESC>O
:inoremap } <c-r>=ClosePair('}')<CR>
:inoremap [ []<ESC>i
:inoremap ] <c-r>=ClosePair(']')<CR>
:inoremap " ""<ESC>i
:inoremap ' ''<ESC>i
function! ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endfunction
filetype plugin indent on

"自动补全代码
"pydiction 1.2 python auto complete
filetype plugin on
let g:pydiction_location = 'D:\python_tool\complete-dict'
"defalut g:pydiction_menu_height == 15
"let g:pydiction_menu_height = 20


execute pathogen#infect()

"pydoc
let g:pydoc_cmd = 'D:\python_tool\pydoc.py'

"jsbeautify的设置

nnoremap <leader>_ff :call g:Jsbeautify()<CR>


"taglist
let Tlist_Ctags_Cmd = 'D:\python_tool\ctags58\ctags.exe' "注意下载ctags
let g:ctags_statusline=1
let generate_tags=1
let Tlist_Use_Horiz_Window=0
map <F4> : TlistToggle<cr>
let Tlist_Show_One_File=1
let Tlist_Use_Right_Window=1
let Tlist_Compact_Format=1
let Tlist_Exit_OnlyWindow=1
let Tlist_GainFocus_On_toggleOpen=1
let Tlist_File_Fold_Auto_Close=1

"nerdtree
map <F3> :NERDTreeToggle<CR>


" 映射全选+复制 ctrl+a
map <C-A> ggVGY
map! <C-A> <Esc>ggVGY
map <F12> gg=G
" 选中状态下 Ctrl+c 复制
vmap <C-c> "+y

map <M-1> 1gtmap <M-2> 2gtmap <M-3> 3gtmap <M-4> 4gtmap <M-5> 5gtmap <M-6> 6gtmap <M-7> 7gtmap <M-8> 8gtmap <M-9> 9gtmap <M-t> :tabnew<CR>map <M-w> :tabclose<CR>map! <M-1> <esc>1gtmap! <M-2> <esc>2gtmap! <M-3> <esc>3gtmap! <M-4> <esc>4gtmap! <M-5> <esc>5gtmap! <M-6> <esc>6gtmap! <M-7> <esc>7gtmap! <M-8> <esc>8gtmap! <M-9> <esc>9gtmap! <M-t> <esc>:tabnew<CR>map! <M-w> <esc>:tabclose<CR> " Use CTRL-S for saving, also in Insert modenoremap <C-S> :update<CR>vnoremap <C-S> <C-C>:update<CR>inoremap <C-S> <C-O>:update<CR>"2006-09-13 以下:保存视图 au BufWinLeave *.ztx mkview au BufWinEnter *.ztx silent loadviewau BufNewFile,BufRead *.tx1 setf tx1

相关文章
相关标签/搜索