Install the javacomplete plug-in VIM
Http://www.vim.org/scripts/script.php? Script_id = 1, 1785
Installation Method: Download javacomplete.zip and then directly CP ~ /. Decompress the file in Vim, or use unzip javacomplete.zip-D ~ /. Vim
Decompress the file
Javacomplete. Vim, java_parser.vim, reflection. Java
It should be in ~ /. Vim/autoload directory
Permission for these files chmod 755/usr/share/Vim/vimfiles/autoload/* (random)
Cd ~ /. Vim/autoload
Javac reflection. Java
Set Java classpath ~ Add the/. Vim/autoload path to the classpath directory.
The process is as follows:
1. Su
2. Vim/etc/profile
3. Add the following content at the end of the file (I am a yum JDK and the JDK path is different, please handle it yourself)
Java_home =/usr/lib/JVM/Java-1.6.0
Path = $ path: $ java_home/bin
Classpath =.: $ java_home/lib/tools. jar: $ java_home/lib/dt. jar :~ /. Vim/autoload
Export path java_home classpath
4. Source/etc/profile
5. Echo $ classpath to check if it is correct
Add setlocal omnifunc = javacomplete # complete to the file ~ /. Vimrc
Autocmd filetype Java set omnifunc = javacomplete # Complete Auto-completion
Autocmd filetype Java set completefunc = javacomplete # completeparamsinf parameter prompt
Inoremap <buffer> <C-X> <C-U> <C-P>
Inoremap <buffer> <c-S-space> <C-X> <C-U> <C-P>
Autocmd filetype Java, JavaScript, JSP inoremap <buffer>... <C-X> <C-O> <C-P> this statement is implemented when Vim edits a Java file.
<C-X> <C-O> <C-P>
The two statements mean that pressing CTRL + X and then pressing CTRL + u will trigger the prompt function. If you call system, a list box will appear to list members in the system class.