ubuntu16.04制作vim和python3的開發(fā)環(huán)境
1. 安裝vim:
# apt-get install -y vim-gnome
2. 安裝ctags,ctags用于支持taglist
# apt-get install ctags
3. 安裝taglist
# apt-get install vim-scripts vim-addon-manager
# vim-addons install taglist
4. 安裝pydiction 實(shí)現(xiàn)代碼補(bǔ)全:
#wget https://www.vim.org/scripts/script.php?script_id=850/pydiction-1.2.3.zip
# unzip pydiction-1.2.3.zip
# cd pydiction/after/ftplugin/
# mkdir /usr/share/vim/vim74/pydiction
# cp -rp python_pydiction.vim /usr/share/vim/vim74/ftplugin/
# cp complete-dict pydiction.py /usr/share/vim/vim74/pydiction/
5.安裝python_fold自動(dòng)折疊插件
下載python_fold.vim:
https://www.vim.org/scripts/script.php?script_id=515
# mv python_fold.vim /usr/share/vim/vim74/plugin/
#vim /root/.vimrc
set foldmethod=indent
6. 生成ctag序列:
進(jìn)入到python腳本所在的目錄,在該目錄下執(zhí)行:
# ctags -R *
生成一個(gè) ctags 文件,該文件記錄了程序/項(xiàng)目的函數(shù)、類等的分析序列記錄.
7. 安裝taglist插件:
下載插件:
https://www.vim.org/scripts/script.php?script_id=273
# unzip taglist_46.zip
# cp plugin/taglist.vim /usr/share/vim/vim74/plugin/
# cp doc/taglist.txt /usr/share/vim/vim74/doc/
#vim
:helptags /usr/share/vim/vim74/doc "生成taglist幫助文件列表。
: help taglist.txt “查看taglist幫助信息。
8. 安裝vim plug:
# mkdir ~/.vim/autoload/
# cd ~/.vim/autoload/
# wget https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
配置vim plug:
#vim /root/.vimrc call plug#begin('~/.vim/autoload') Plug 'Valloric/YouCompleteMe' call plug#end() #vim /root/.vimrc filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/vundle call vundle#begin() " let Vundle manage Vundle, required Plugin 'VundleVim/Vundle.vim' Plugin 'vim-scripts/indentpython.vim' Bundle 'Valloric/YouCompleteMe' " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required call plug#begin('~/.vim/autoload') Plug 'Valloric/YouCompleteMe' call plug#end() set nocompatible "關(guān)閉與vi的兼容模式 set number "顯示行號(hào) set nowrap "不自動(dòng)折行 set showmatch "顯示匹配的括號(hào) set scrolloff=3 "距離頂部和底部3行" set encoding=utf-8 "編碼 set fenc=utf-8 "編碼 "set mouse=a "啟用鼠標(biāo) set hlsearch "搜索高亮 syntax on "語(yǔ)法高亮 set helplang=cn set encoding=utf-8 "au BufNewFile,BufRead *.py set tabstop=4 set softtabstop=4 set shiftwidth=4 set textwidth=79 set expandtab set autoindent set fileformat=unix set foldmethod=indent set autoindent " 實(shí)現(xiàn)自動(dòng)縮進(jìn) set foldmethod=indent set shiftwidth=4 set expandtab set number "Flagging Unnecessary Whitespace highlight BadWhitespace ctermbg=red guibg=darkred 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 filetype plugin on let g:pydiction_location = '/usr/share/vim/vim74/pydiction/complete-dict' let g:pydiction_menu_height = 20 autocmd FileType python set omnifunc=pythoncomplete#Complete let Tlist_Show_One_File = 1 "不同時(shí)顯示多個(gè)文件的tag,只顯示當(dāng)前文件的 let Tlist_Exit_OnlyWindow = 1 "如果 taglist 窗口是最后一個(gè)窗口,則退出 vim let Tlist_Use_Right_Window = 1 "在右側(cè)窗口中顯示 taglist 窗口 "let Tlist_Auto_Open=1 "在啟動(dòng) vim 后,自動(dòng)打開 taglist 窗口 "let Tlist_File_Fold_Auto_Close=1 "只顯示當(dāng)前文件 tag,其它文件的tag折疊 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 autocmd FileType python set omnifunc=pythoncomplete#Complete
插件安裝:
切換到命令行模式,依次輸入
PlugStatus
PlugInstall
就可以安裝插件了
使用vim plug可以方便的管理插件
查看插件類型:
:PlugStatus
安裝插件:
:PlugInstall
更新插件::PlugUpdate
vim-plug本身更新::PlugUpgrade
- vitrualBox+ubuntu16.04安裝python3.6最新教程及詳細(xì)步驟
- Ubuntu16.04安裝python3.6.5步驟詳解
- 詳解Ubuntu16.04安裝Python3.7及其pip3并切換為默認(rèn)版本
- 在ubuntu16.04中將python3設(shè)置為默認(rèn)的命令寫法
- ubuntu16.04在python3 下創(chuàng)建Django項(xiàng)目并運(yùn)行的操作方法
- Ubuntu16.04/樹莓派Python3+opencv配置教程(分享)
- Linux-ubuntu16.04 Python3.5配置OpenCV3.2的方法
- Ubuntu16.04 安裝多個(gè)python版本的問題及解決方法
相關(guān)文章
如何通過Python3和ssl實(shí)現(xiàn)加密通信功能
這篇文章主要介紹了如何通過Python3和ssl實(shí)現(xiàn)加密通信功能,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下2020-05-05Python基于ThreadingTCPServer創(chuàng)建多線程代理的方法示例
這篇文章主要介紹了Python基于ThreadingTCPServer創(chuàng)建多線程代理的方法,結(jié)合實(shí)例形式分析了Python使用ThreadingTCPServer模塊實(shí)現(xiàn)多線程代理功能進(jìn)行網(wǎng)絡(luò)請(qǐng)求響應(yīng)的相關(guān)操作技巧,需要的朋友可以參考下2018-01-01使用python+pygame開發(fā)消消樂游戲附完整源碼
消消樂小游戲相信大家都玩過,大人小孩都喜歡玩的一款小游戲,那么基于程序是如何實(shí)現(xiàn)的呢?今天帶大家,用python+pygame來(lái)實(shí)現(xiàn)一下這個(gè)花里胡哨的消消樂小游戲功能,感興趣的朋友一起看看吧2021-06-06python機(jī)器學(xué)習(xí)理論與實(shí)戰(zhàn)(六)支持向量機(jī)
這篇文章主要介紹了python機(jī)器學(xué)習(xí)理論與實(shí)戰(zhàn)第六篇,支持向量機(jī)的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2018-01-01matplotlib savefig 保存圖片大小的實(shí)例
今天小編就為大家分享一篇matplotlib savefig 保存圖片大小的實(shí)例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來(lái)看看吧2018-05-05Python解析json時(shí)提示“string indices must be integers”問題解決方法
這篇文章主要介紹了Python解析json時(shí)提示“string indices must be integers”問題解決方法,結(jié)合實(shí)例形式分析了Python解析json字符串操作規(guī)范與相關(guān)使用技巧,需要的朋友可以參考下2019-07-07