Java auto-completion plug-in

Source: Internet
Author: User
Tags autoload

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.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.