ubuntu16.04制作vim和python3的开发环境
1.安装vim:
#apt-getinstall -yvim-gnome
2.安装ctags,ctags用于支持taglist
#apt-getinstallctags
3.安装taglist
#apt-getinstallvim-scriptsvim-addon-manager
#vim-addonsinstalltaglist
4.安装pydiction实现代码补全:
#wget https://www.vim.org/scripts/script.php?script_id=850/pydiction-1.2.3.zip
#unzippydiction-1.2.3.zip
#cdpydiction/after/ftplugin/
#mkdir/usr/share/vim/vim74/pydiction
#cp -rppython_pydiction.vim /usr/share/vim/vim74/ftplugin/
#cpcomplete-dictpydiction.py /usr/share/vim/vim74/pydiction/
5.安装python_fold自动折叠插件
下载python_fold.vim:
https://www.vim.org/scripts/script.php?script_id=515
#mvpython_fold.vim/usr/share/vim/vim74/plugin/
#vim/root/.vimrc
setfoldmethod=indent
6.生成ctag序列:
进入到python脚本所在的目录,在该目录下执行:
#ctags-R*
生成一个ctags文件,该文件记录了程序/项目的函数、类等的分析序列记录.
7.安装taglist插件:
下载插件:
https://www.vim.org/scripts/script.php?script_id=273
#unziptaglist_46.zip
#cpplugin/taglist.vim /usr/share/vim/vim74/plugin/
#cpdoc/taglist.txt /usr/share/vim/vim74/doc/
#vim
:helptags/usr/share/vim/vim74/doc "生成taglist帮助文件列表。
:helptaglist.txt “查看taglist帮助信息。
8.安装vim plug:
#mkdir~/.vim/autoload/
#cd~/.vim/autoload/
#wgethttps://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
配置vimplug:
#vim/root/.vimrc callplug#begin('~/.vim/autoload') Plug'Valloric/YouCompleteMe' callplug#end() #vim/root/.vimrc filetypeoff"required "settheruntimepathtoincludeVundleandinitialize setrtp+=~/.vim/bundle/vundle callvundle#begin() "letVundlemanageVundle,required Plugin'VundleVim/Vundle.vim' Plugin'vim-scripts/indentpython.vim' Bundle'Valloric/YouCompleteMe' "AllofyourPluginsmustbeaddedbeforethefollowingline callvundle#end()"required filetypepluginindenton"required callplug#begin('~/.vim/autoload') Plug'Valloric/YouCompleteMe' callplug#end() setnocompatible"关闭与vi的兼容模式 setnumber"显示行号 setnowrap"不自动折行 setshowmatch"显示匹配的括号 setscrolloff=3"距离顶部和底部3行" setencoding=utf-8"编码 setfenc=utf-8"编码 "setmouse=a"启用鼠标 sethlsearch"搜索高亮 syntaxon"语法高亮 sethelplang=cn setencoding=utf-8 "auBufNewFile,BufRead*.py settabstop=4 setsofttabstop=4 setshiftwidth=4 settextwidth=79 setexpandtab setautoindent setfileformat=unix setfoldmethod=indent setautoindent"实现自动缩进 setfoldmethod=indent setshiftwidth=4 setexpandtab setnumber "FlaggingUnnecessaryWhitespace highlightBadWhitespacectermbg=redguibg=darkred letTlist_Auto_Highlight_Tag=1 letTlist_Auto_Open=1 letTlist_Auto_Update=1 letTlist_Display_Tag_Scope=1 letTlist_Exit_OnlyWindow=1 letTlist_Enable_Dold_Column=1 letTlist_File_Fold_Auto_Close=1 letTlist_Show_One_File=1 letTlist_Use_Right_Window=1 letTlist_Use_SingleClick=1 filetypepluginon letg:pydiction_location='/usr/share/vim/vim74/pydiction/complete-dict' letg:pydiction_menu_height=20 autocmdFileTypepythonsetomnifunc=pythoncomplete#Complete letTlist_Show_One_File=1"不同时显示多个文件的tag,只显示当前文件的 letTlist_Exit_OnlyWindow=1"如果taglist窗口是最后一个窗口,则退出vim letTlist_Use_Right_Window=1"在右侧窗口中显示taglist窗口 "letTlist_Auto_Open=1"在启动vim后,自动打开taglist窗口 "letTlist_File_Fold_Auto_Close=1"只显示当前文件tag,其它文件的tag折叠 letTlist_Auto_Highlight_Tag=1 letTlist_Auto_Open=1 letTlist_Auto_Update=1 letTlist_Display_Tag_Scope=1 letTlist_Exit_OnlyWindow=1 letTlist_Enable_Dold_Column=1 letTlist_File_Fold_Auto_Close=1 letTlist_Show_One_File=1 letTlist_Use_Right_Window=1 letTlist_Use_SingleClick=1 nnoremap:TlistToggle filetypepluginon autocmdFileTypepythonsetomnifunc=pythoncomplete#Complete autocmdFileTypejavascrīptsetomnifunc=javascriptcomplete#CompleteJS autocmdFileTypehtmlsetomnifunc=htmlcomplete#CompleteTags autocmdFileTypecsssetomnifunc=csscomplete#CompleteCSS autocmdFileTypexmlsetomnifunc=xmlcomplete#CompleteTags autocmdFileTypephpsetomnifunc=phpcomplete#CompletePHP autocmdFileTypecsetomnifunc=ccomplete#Complete autocmdFileTypepythonsetomnifunc=pythoncomplete#Complete
插件安装:
切换到命令行模式,依次输入
PlugStatus
PlugInstall
就可以安装插件了
使用vimplug可以方便的管理插件
查看插件类型:
:PlugStatus
安装插件:
:PlugInstall
更新插件::PlugUpdate
vim-plug本身更新::PlugUpgrade