1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 02:50:03 +08:00
SpaceVim/docs/_posts/2017-02-11-use-vim-as-a-java-ide.md
2018-01-25 22:57:56 +08:00

5.6 KiB

title categories excerpt redirect_from type comments
Use Vim as a Java IDE tutorials I am a vimmer and a java developer. Here are some useful plugins for developing java in vim/neovim. /2017/02/11/use-vim-as-a-java-ide.html BlogPosting true

Blogs > Use Vim as a Java IDE

I am a vimmer and a java developer. Here are some useful plugins for developing java in vim/neovim.

beautiful UI

Project manager

  1. unite - file and code fuzzy founder.

The next version of unite is denite, Denite is a dark powered plugin for Neovim/Vim to unite all interfaces.

unite

The unite or unite.vim plug-in can search and display information from arbitrary sources like files, buffers, recently used files or registers. You can run several pre-defined actions on a target displayed in the unite window.

The difference between unite and similar plug-ins like fuzzyfinder, ctrl-p or ku is that unite provides an integration interface for several sources and you can create new interfaces using unite.

You can also use unite with ag, that will make searching faster.

config unite with ag or other tools support

if executable('hw')
    " Use hw (highway)
    " https://github.com/tkengo/highway
    let g:unite_source_grep_command = 'hw'
    let g:unite_source_grep_default_opts = '--no-group --no-color'
    let g:unite_source_grep_recursive_opt = ''
elseif executable('ag')
    " Use ag (the silver searcher)
    " https://github.com/ggreer/the_silver_searcher
    let g:unite_source_grep_command = 'ag'
    let g:unite_source_grep_default_opts =
                \ '-i --line-numbers --nocolor ' .
                \ '--nogroup --hidden --ignore ' .
                \ '''.hg'' --ignore ''.svn'' --ignore' .
                \ ' ''.git'' --ignore ''.bzr'''
    let g:unite_source_grep_recursive_opt = ''
elseif executable('pt')
    " Use pt (the platinum searcher)
    " https://github.com/monochromegane/the_platinum_searcher
    let g:unite_source_grep_command = 'pt'
    let g:unite_source_grep_default_opts = '--nogroup --nocolor'
    let g:unite_source_grep_recursive_opt = ''
elseif executable('ack-grep')
    " Use ack
    " http://beyondgrep.com/
    let g:unite_source_grep_command = 'ack-grep'
    let g:unite_source_grep_default_opts =
                \ '-i --no-heading --no-color -k -H'
    let g:unite_source_grep_recursive_opt = ''
elseif executable('ack')
    let g:unite_source_grep_command = 'ack'
    let g:unite_source_grep_default_opts = '-i --no-heading' .
                \ ' --no-color -k -H'
    let g:unite_source_grep_recursive_opt = ''
elseif executable('jvgrep')
    " Use jvgrep
    " https://github.com/mattn/jvgrep
    let g:unite_source_grep_command = 'jvgrep'
    let g:unite_source_grep_default_opts =
                \ '-i --exclude ''\.(git|svn|hg|bzr)'''
    let g:unite_source_grep_recursive_opt = '-R'
elseif executable('beagrep')
    " Use beagrep
    " https://github.com/baohaojun/beagrep
    let g:unite_source_grep_command = 'beagrep'
endif
  1. vimfiler - A powerful file explorer implemented in Vim script

Use vimfiler as default file explorer

for more information, you should read the documentation of vimfiler.

let g:vimfiler_as_default_explorer = 1
call vimfiler#custom#profile('default', 'context', {
            \ 'explorer' : 1,
            \ 'winwidth' : 30,
            \ 'winminwidth' : 30,
            \ 'toggle' : 1,
            \ 'columns' : 'type',
            \ 'auto_expand': 1,
            \ 'direction' : 'rightbelow',
            \ 'parent': 0,
            \ 'explorer_columns' : 'type',
            \ 'status' : 1,
            \ 'safe' : 0,
            \ 'split' : 1,
            \ 'hidden': 1,
            \ 'no_quit' : 1,
            \ 'force_hide' : 0,
            \ })
  1. tagbar - Vim plugin that displays tags in a window, ordered by scope

Code formatting

  1. neoformat - A (Neo)vim plugin for formatting code.

For formatting java code, you also nEed have uncrustify or astyle in your PATH. BTW, the google's java formatter also works well with neoformat.

Code completion

  1. javacomplete2 - Updated javacomplete plugin for vim

    • Demo

    vim-javacomplete2

    • Generics demo

    vim-javacomplete2

  2. deoplete.nvim - Dark powered asynchronous completion framework for neovim

  3. neocomplete.vim - Next generation completion framework after neocomplcache

Syntax lint

  1. neomake - Asynchronous linting and make framework for Neovim/Vim

I am maintainer of javac maker in neomake, the javac maker support maven project, gradle project or eclipse project. also you can set the classpath.

REPL

you need to install jdk8 which provide a build-in tools jshell, and SpaceVim use the jshell as default inferior REPL process:

REPl-JAVA