ubuntu16.04制作vim和python3的开发环境
作者:鸿鹄安然 发布时间:2022-08-11 00:11:07
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/.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 "关闭与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=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 " 实现自动缩进
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 "不同时显示多个文件的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=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
来源:http://blog.51cto.com/liyuanjie/2179139
猜你喜欢
- BeautifulSoup简介Beautiful Soup是python的一个库,最主要的功能是从网页抓取数据。官方解释如下:Beautif
- 下午有同学Python学习群里说,使用pyinstaller打包源码时,因为代码中使用了图像、音频、视频等资源文件,无法将程序打包成单一的可
- 在dreamweaver4中,你可以存储你自己设定的图片,链接,flash影片,颜色表,模板等等,组成这个站点的资产,这就是Assets面板
- MySQL扩展库操作MySQL数据库的步骤如下:1:获取连接.2:选取书库。3:设置操作编码。4:发送SQL指令(MySQL数据库可以分为四
- editTable.js 提供编辑表格当前行、添加一行、删除当前行的操作,其中可以设置参数,如:operatePos 用于设置放置操作的列,
- 1. 二维(多维)数组降为一维数组方法1: reshape()+concatenate 函数,这个方法是间接法,利用 reshape() 函
- 减少HTTP请求,是可以提高网站速度的,把所有的背景图像都放到一个图片文件中,然后通过CSS的background-image和backgr
- 问题Django 报错 [2019-09-16 16:47:27,981] - Broken pipe from ('127.0.0
- 第一步:字母转数字英文字母转对应数字相对简单,可以在命令行输入一行需要转换的英文字母,然后对每一个字母在整个字母表中匹配,并返回相应的位数,
- DataList Web 服务器控件 通过使用模板显示数据源中的项。通过操作组成 DataList
- 1、Numpy是什么很简单,Numpy是Python的一个科学计算的库,提供了矩阵运算的功能,其一般与Scipy、matplotlib一起使
- 简介今天试着用ptyhon做了一个抓取网页内容,并生成word文档的功能,功能很简单,做一下记录以备以后用到。生成word用到了第三方组件p
- config.php<?phpdefine('APP_DIR', dirname(__FILE__));define(
- 原型扩展:>> String.prototype :String对象原型扩展 --------------
- Check In/Out功能简介:该功能是专门针对多用户管理而预设的。即多用户使用多帐号管理同一站点。
- 第一种import win32clipboardimport time#速度快 容易出错class niubi(): def l
- 几天前我在考虑使用 python 从 whatsapp 发送消息。和你们一样,我开始潜伏在互联网上寻找一些解决方案并找到了关于twilio.
- 最近看到一个词叫css reset。什么叫做css reset呢?我理解为重置css,也就是重置默认样式。我在HTML下的默认样式中讲到,一
- 代码如下:--新增表字段 ALTER procedure [dbo].[sp_Web_TableFiled_Insert] (
- 这篇文章主要介绍了Python中使用gflags实例及原理解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,