轉 Ubuntu 下 vim 搭建python 環境 配置


1. 安裝完整的vim
# apt-get install vim-gnome

2. 安裝ctags,ctags用於支持taglist,必需!
# apt-get install ctags

3. 安裝taglist
#apt-get install vim-scripts
#apt-get install vim-addon-manager
# vim-addons install taglist

4. 安裝pydiction(實現代碼補全)
#wget http://www.pythonclub.org/_media/Python-basic/pydiction-1.2.zip
#unzip pydiction-1.2.zip

// ~/.vim/after/ftplugin和~/.vim/tools/pydiction/目錄默認不存在,需要自行創建
#cp pydiction-1.2/python_pydiction.vim ~/.vim/after/ftplugin
#cp pydiction-1.2/complete-dict ~/.vim/tools/pydiction/complete-dict

5. 編輯配置文件
//~/.vimrc 修改當前用戶配置,如果需要修改全局配置,vim /etc/vim/vimrc
# 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>

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
set lines=35 columns=118

右邊即為taglist窗口,按F8打開,使用Ctrl+w,再按w可以在code窗口和taglist窗口間切換


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM