首页 > 代码库 > 在vim中配置python补全,fedora 19

在vim中配置python补全,fedora 19

最近发现python是个不错的语言,值得一学,先配置下环境,让vim具有关键字补全功能,过程如下,我这个是fedora,其他发行版类似


$ su

********

# yum install vim-taglist -y

# wget http://www.pythonclub.org/_media/python-basic/pydiction-1.2.zip
# unzip pydiction-1.2.zip
 
# mkdir -p  ~/.vim/after/ftplugin
# mkdir -p ~/.vim/tools/pydiction/
# cp pydiction-1.2/python_pydiction.vim ~/.vim/after/ftplugin
# cp pydiction-1.2/complete-dict ~/.vim/tools/pydiction/complete-dict
 
# vim ~/.vimrc

let Tlist_Auto_Highlight_Tag=1  
let Tlist_Auto_Open=1  
let Tlist_Auto_Update=1  
let Tlist_Display_Tag_Scope=1  
let Tlist_Exit_OnlyWindow=1  
let Tlist_Enable_Dold_Column=1  
let Tlist_File_Fold_Auto_Close=1  
let Tlist_Show_One_File=1  
let Tlist_Use_Right_Window=1  
let Tlist_Use_SingleClick=1  
nnoremap <silent> <F8> :TlistToggle<CR>  // 设定F8为taglist开关
   
filetype plugin on  
autocmd FileType python set omnifunc=pythoncomplete#Complete  
autocmd FileType javascrīpt 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 php set omnifunc=phpcomplete#CompletePHP  
autocmd FileType c set omnifunc=ccomplete#Complete  
   
   
let g:pydiction_location='~/.vim/tools/pydiction/complete-dict'  
set autoindent
set tabstop=4  
set shiftwidth=4  
set expandtab  
set number

可以通过tab键来补全,F8键打开/关闭taglist,Ctrl+W在窗口中切换



参考:

http://tntcastle.net/2012/09/ubuntu%E4%B8%8B%E5%B0%86vim%E9%85%8D%E7%BD%AE%E4%B8%BApython-ide/

http://www.pythonclub.org/linux/vim/pydiction

在vim中配置python补全,fedora 19