1. 程式人生 > >在vim中配置python補全,fedora 19

在vim中配置python補全,fedora 19

too bst upd log python ext tab win nco

近期發現python是個不錯的語言,值得一學,先配置下環境,讓vim具有keyword補全功能,步驟例如以下,我這個是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