Skip to content

Instantly share code, notes, and snippets.

@dangkhoasdc
Created November 14, 2017 09:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dangkhoasdc/44bc99ca62a0f8072da2194d7a19d00b to your computer and use it in GitHub Desktop.
Save dangkhoasdc/44bc99ca62a0f8072da2194d7a19d00b to your computer and use it in GitHub Desktop.

Vim Configuration

javacomplete2 + nvim-complete-manager

Compile algs4 with Maven

  1. Install maven
sudo apt-get install maven
  1. Clone the project: algs4
  2. Compile algs4:
cd algs4
mvn compile

Install plugins

To install plugins:

    Plug 'roxma/nvim-completion-manager'
    Plug 'artur-shaik/vim-javacomplete2', {'for': 'java'}

Append following code to vimrc:

autocmd FileType java setlocal omnifunc=javacomplete#Complete
set runtimepath^=~/.config/nvim/plugged/vim-javacomplete2/libs
let g:JavaComplete_LibsPath = "/path/to/algs4/target/classes"
let g:JavaComplete_MavenRepositoryDisable = 0
au User CmSetup call cm#register_source({'name' : 'cm-java',
		\ 'priority': 9,
		\ 'scoping': 0,
		\ 'scopes': ['java'],
		\ 'abbreviation': 'java',
		\ 'cm_refresh_patterns': ['\w+\.'],
		\ 'cm_refresh': {'omnifunc': 'javacomplete#Complete'},
		\ })

Problems

Workaround if the plugin does not work:

  1. Remove all caches in ~/.cache/javacomplete2/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment