相关插件:
补全(推荐:5星):@L_301_0@
重构(推荐:5星):factorus
语法检测(推荐:5星):ale
代码块插入(推荐:5星):ultilsnips | vim-snippets
中英互译(推荐:4星):dict.vim
命令行美化(推荐:特殊点4星,):vim-airline
平滑滚屏(推荐:3星):vim-smooth-scroll
主要的5星推荐,辅助4星 ^_^ 。3基本跟主题无关了。
相关工具:
maven
gradle
ant
vim要求支持 python3
参考:https://my.oschina.net/asd945/blog/667195
参考:http://www.cnblogs.com/274914765qq/p/4439300.html
配置参数注意:先—enable,后—with。弄错就make uninstall&&make clean&&重新配置编译安装。
vim-javacomplete2:
参考:https://unmi.cc/vim-java-autocomplete-with-vim-javacomplete2/#more-7708
这个网络资源不多,我简要说下。
1. 先安装 git 工具。
$sudo apt install git
2. 建立目录 ~/.vim/bundle (有了就跳过)
$mkdir ~/.vim/bundle -p
3. 进入目录
$cd ~/.vim/bundle
4. 下载 java-complete2
$git clone https://github.com/artur-shaik/vim-javacomplete2.git
参考上面的文章,
$cd vim-javacomplete2/libs/javavi/
$mvn compile
(没有maven就先安装。也把gradle安装了。网上自行下载配置环境变量,或者直接apt install)
5. 使用你的插件管理器管理 java-complete2 (最好看帮助文档)
修改 autoload/javacomplete/server.vim 191行,如下:
let command = ['mvn','-f','"'. javaviDir . 'pom.xml"','compile']
Factorus
1. 下载
$cd ~/.vim/bundle
$git clone https://github.com/apalmer1377/factorus.git
ale
参考:https://zhuanlan.zhihu.com/p/23317292
参考:http://blog.csdn.net/demorngel/article/details/69052789
1. 下载
$cd ~/.vim/bundle
$git clone https://github.com/w0rp/ale.git ./ale
2. 配置(看帮助文档)
其他的参考网络资源。
附我的插件配置
有些配置不太合理,将就着吧。有大神知道更好的配置记得抽空也告诉我一下^_^。先谢过了!
" 复制以下到 .vimrc 或者在该文件中引入这些配置:source filename " 定义 <Leader> 为逗号 let mapleader = ";" let maplocalleader = ";" set nocompatible " 去除VI一致性,必须 filetype off " 必须 set rtp+=~/.vim/bundle/vim-plug call plug#begin('/home/ljx/.vim/bundle/vim-plug') " java 补全插件 Plug 'file:///home/ljx/.vim/bundle/vim-javacomplete2' " c 系列补全插件 (还没配置好) "Plug 'file:///home/ljx/.vim/bundle/YouCompleteMe' " 重构 Plug 'file:///home/ljx/.vim/bundle/factorus' " 代码检查 Plug 'file:///home/ljx/.vim/bundle/ale' " 文件搜索 (快) Plug 'file:///home/ljx/.vim/bundle/fzf' " 代码排版 格式化插件 Plug 'file:///home/ljx/.vim/bundle/vim-easy-align' " 搜索(文件内容、快) Plug 'file:///home/ljx/.vim/bundle/ag' " 中英互译 Plug 'file:///home/ljx/.vim/bundle/dict.vim' " 分隔符补全 Plug 'file:///home/ljx/.vim/bundle/delimitMate' " 异步任务插件 Plug 'file:///home/ljx/.vim/bundle/vim-dispatch' " 分隔符补全 Plug 'file:///home/ljx/.vim/bundle/vim-surround' " vim 命令行美化插件 Plug 'file:///home/ljx/.vim/bundle/vim-airline' " 关灯---- Plug 'file:///home/ljx/.vim/bundle/limelight.vim' " 版本控制 git svn Plug 'file:///home/ljx/.vim/bundle/vim-signify' " 文件目录结构视图 Plug 'file:///home/ljx/.vim/bundle/nerdtree' " 方法函数变量视图 Plug 'file:///home/ljx/.vim/bundle/tagbar' " Plug 'file:///home/ljx/.vim/bundle/vim-rooter' " 平滑滚屏 Plug 'file:///home/ljx/.vim/bundle/vim-smooth-scroll' " 代码快插入 Plug 'SirVer/ultisnips' Plug 'file:///home/ljx/.vim/bundle/vim-snippets' "Plug 'junegunn/vim-easy-align' "Plug 'artur-shaik/vim-javacomplete2' "Plug 'Valloric/YouCompleteMe' "Plug 'mhinz/vim-signify' "Plug 'w0rp/ale' "Plug 'junegunn/fzf' "Plug 'junegunn/limelight.vim' "Plug 'scrooloose/nerdtree' "Plug 'honza/vim-snippets' "Plug 'iamcco/dict.vim' "Plug 'Raimondi/delimitMate' "Plug 'tpope/vim-dispatch' "Plug 'tpope/vim-surround' "Plug 'vim-airline/vim-airline' call plug#end() filetype plugin indent on " javacomplete2 setting " 禁用maven存储库: let g:JavaComplete_MavenRepositoryDisable = 1 " 使用完全限定名称描述: let g:JavaComplete_UseFQN = 1 " 显式地设置pom.xml路径: 默认 let g:JavaComplete_PomPath = '/home/ljx/.vim/bundle/vim-plug/vim-javacomplete2/libs/javavi/pom.xml' " 在方法声明完成时闭合括号: let g:JavaComplete_ClosingBrace = 1 " javacomplete2基础缓存目录(缺省为 ~/.cache): let g:JavaComplete_JavaviLogfileDirectory = '~/tmp' let g:JavaComplete_JavaviDebug = 1 let g:JavaComplete_BaseDir = '~/tmp' " 使用自己的gradle可执行文件: let g:JavaComplete_GradleExecutable = '/opt/gradle-3.4.1/bin/gradle' " 构造javacomplete2使用python3解释器而不是python2: let g:JavaComplete_UsePython3 = 1 let g:JavaComplete_ShowExternalCommandsOutput=1 if isdirectory('lib') != 0 let s:path=expand("./lib/*.jar") else let s:path=expand("./*.jar") endif if s:path == "./lib/*.jar" let s:path='' else let s:classpath=substitute(s:path,'\n',':','g') let s:fixclasspath=$CLASSPATH . ':' . s:classpath let g:JavaComplete_LibsPath=s:fixclasspath " ale java let g:ale_java_javac_classpath=s:fixclasspath endif "if isdirectory('./java') " let g:JavaComplete_SourcesPath='./java' "elseif isdirectory('./src/main') " "let g:JavaComplete_SourcesPath='./src/main' "elseif isdirectory('./src') " let g:JavaComplete_SourcesPath='./src' "else " let g:JavaComplete_SourcesPath='.' "endif " 重构 "let g:factorus_project_dir=g:JavaComplete_SourcesPath autocmd VimEnter * let g:factorus_project_dir=getcwd() . '/src/main' " ale " 保持侧边栏可见 let g:ale_sign_column_always = 1 let g:ag_prg="/usr/bin/ag --vimgrep" let g:ag_working_path_mode="r" " ------ javacomplete ------ autocmd FileType java setlocal omnifunc=javacomplete#Complete autocmd FileType java inoremap . .<c-x><c-o><c-p> autocmd FileType java JCdebugEnableLogs autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS autocmd FileType html setlocal omnifunc=htmlcomplete#CompleteTags autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS autocmd FileType sql setlocal omnifunc=sqlcomplete#Complete autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags " 平滑滚屏 noremap <silent> <c-u> :call smooth_scroll#up(&scroll,2)<CR> noremap <silent> <c-d> :call smooth_scroll#down(&scroll,2)<CR> noremap <silent> <c-b> :call smooth_scroll#up(&scroll*2,4)<CR> noremap <silent> <c-f> :call smooth_scroll#down(&scroll*2,4)<CR> " ------ nerdtree ------ noremap <F2> :NERDTreeToggle<CR> autocmd VimEnter * NERDTree autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif let g:NERDTreeDirArrowExpandable = '▸' let g:NERDTreeDirArrowCollapsible = '▾' " tree 宽度尺寸 let NERDTreeWinSize=30 " ------ tagbar ------ let g:tagbar_ctags_bin='/usr/bin/ctags' let g:tagbar_width=30 let g:tagbar_iconchars = ['▸','▾'] noremap <silent><leader>ta :TagbarToggle<CR> "let shell='/bin/bash' " ------ dict ------ set dictionary+=/usr/share/dict/words autocmd FileType text,markdown setlocal complete+=k " ------ ultisnips ------ let g:UltiSnipsExpandTrigger="<tab>" let g:UltiSnipsJumpForwardTrigger="<c-b>" let g:UltiSnipsJumpBackwardTrigger="<c-z>" " ------ vim-rooter " 指定如何识别项目的根目录: let g:rooter_patterns = ['build.xml','lib/'] " 自动停止vim-rooter改变目录: let g:rooter_manual_only = 1 " 改变目录仅供当前窗口(:lcd): let g:rooter_use_lcd = 1 " 停止vim-rooter呼应项目目录: let g:rooter_silent_chdir = 1
有误请指出^_^。小菜鸟好修改,学习。THANKS!
原文链接:https://www.f2er.com/bash/391885.html