vim java自动补全插件(目前还不好使,之后好使了会接着更)

vimrc配置文件

初始时是没有这个文件的,需要自己写

set nu “显示行号 

syntax on “自动语法高亮 

set shiftwidth=4 “默认缩进4个空格 

set softtabstop=4 “使用tab时 tab空格数 

set tabstop=4 “tab 代表4个空格 

set expandtab “使用空格替换tab
安装vundle

说是安装,实际上只是将github上的工程clone到~/.vim/bundle/Vundle.vim/目录下就可以了
详细安装方法参考https://github.com/VundleVim/Vundle.vim#quick-start这个链接

在命令行下执行下面的命令(命令中后面的文件夹及其中的文件会自动生成)

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

更改vimrc配置文件,将下面的东西添加到vimrc文件首部

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')

" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'


Plugin 'artur-shaik/vim-javacomplete2'



" All of your Plugins must be added before the following line
call vundle#end()            " required
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on
"
" Brief help
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal
"
" see :h vundle for more details or wiki for FAQ
" Put your non-Plugin stuff after this line

注意,上面的内容与github上的样例不同,我将所有的example删除了,更换成此时我需要的javacomplete插件
就是在beginend之间添加响应语句即可Plugin 'artur-shaik/vim-javacomplete2'

然后运行 vim ,再运行 :PluginInstall

然后出现下面这个界面
在这里插入图片描述
这个界面的意思应该是插件正在下载

经过很长时间之后(可能是阿里云的网速不行,所以花了很多时间),会出现如下界面

在这里插入图片描述
在上图中显示了Done!这个字样

接下来再次修改vimrc文件,让这个插件与java文件关联起来

autocmd FileType java setlocal omnifunc=javacomplete#Complete

目前还是不好使,不知道为什么

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值