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

相關文章
相關標籤/搜索