ubuntu16.04制作vim和python3的开发环境
linux  /  管理员 发布于 4年前   439
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 实现代码补全:
#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自动折叠插件
下载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序列:
进入到python脚本所在的目录,在该目录下执行: # ctags -R *
生成一个 ctags 文件,该文件记录了程序/项目的函数、类等的分析序列记录.
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/.vimrcfiletype off " required " set the runtime path to include Vundle and initializeset rtp+=~/.vim/bundle/vundlecall vundle#begin() " let Vundle manage Vundle, requiredPlugin 'VundleVim/Vundle.vim'Plugin 'vim-scripts/indentpython.vim'Bundle 'Valloric/YouCompleteMe'" All of your Plugins must be added before the following linecall vundle#end() " requiredfiletype plugin indent on " requiredcall plug#begin('~/.vim/autoload')Plug 'Valloric/YouCompleteMe'call plug#end()set nocompatible "关闭与vi的兼容模式set number "显示行号set nowrap "不自动折行set showmatch "显示匹配的括号set scrolloff=3 "距离顶部和底部3行"set encoding=utf-8 "编码set fenc=utf-8 "编码"set mouse=a "启用鼠标set hlsearch "搜索高亮syntax on "语法高亮set helplang=cnset encoding=utf-8"au BufNewFile,BufRead *.pyset tabstop=4set softtabstop=4set shiftwidth=4set textwidth=79set expandtabset autoindentset fileformat=unixset foldmethod=indentset autoindent " 实现自动缩进set foldmethod=indentset shiftwidth=4set expandtabset number"Flagging Unnecessary Whitespacehighlight BadWhitespace ctermbg=red guibg=darkredlet Tlist_Auto_Highlight_Tag=1let Tlist_Auto_Open=1let Tlist_Auto_Update=1let Tlist_Display_Tag_Scope=1let Tlist_Exit_OnlyWindow=1let Tlist_Enable_Dold_Column=1let Tlist_File_Fold_Auto_Close=1let Tlist_Show_One_File=1let Tlist_Use_Right_Window=1let Tlist_Use_SingleClick=1filetype plugin onlet g:pydiction_location = '/usr/share/vim/vim74/pydiction/complete-dict' let g:pydiction_menu_height = 20autocmd FileType python set omnifunc=pythoncomplete#Completelet Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的 let Tlist_Exit_OnlyWindow = 1 "如果 taglist 窗口是最后一个窗口,则退出 vim let Tlist_Use_Right_Window = 1 "在右侧窗口中显示 taglist 窗口 "let Tlist_Auto_Open=1 "在启动 vim 后,自动打开 taglist 窗口"let Tlist_File_Fold_Auto_Close=1 "只显示当前文件 tag,其它文件的tag折叠 let Tlist_Auto_Highlight_Tag=1let Tlist_Auto_Open=1let Tlist_Auto_Update=1let Tlist_Display_Tag_Scope=1let Tlist_Exit_OnlyWindow=1let Tlist_Enable_Dold_Column=1let Tlist_File_Fold_Auto_Close=1let Tlist_Show_One_File=1let Tlist_Use_Right_Window=1let Tlist_Use_SingleClick=1nnoremap <silent> <F8> :TlistToggle<CR>filetype plugin onautocmd FileType python set omnifunc=pythoncomplete#Completeautocmd FileType javascrīpt set omnifunc=javascriptcomplete#CompleteJSautocmd FileType html set omnifunc=htmlcomplete#CompleteTagsautocmd FileType css set omnifunc=csscomplete#CompleteCSSautocmd FileType xml set omnifunc=xmlcomplete#CompleteTagsautocmd FileType php set omnifunc=phpcomplete#CompletePHPautocmd FileType c set omnifunc=ccomplete#Completeautocmd FileType python set omnifunc=pythoncomplete#Complete
插件安装:
切换到命令行模式,依次输入
PlugStatus
PlugInstall
就可以安装插件了
使用vim plug可以方便的管理插件
查看插件类型:
:PlugStatus
安装插件:
:PlugInstall
更新插件::PlugUpdate
vim-plug本身更新::PlugUpgrade
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号