config/.vim/eclim/doc/vim/java/format.txt

82 lines
1.6 KiB
Plaintext
Raw Normal View History

*vim-java-format*
Java Source Code Formatting
***************************
Eclim provides the ability to format java source code using the
eclipse formatter selected for your workspace.
Source code formatting is invoked in eclipse using the shortcut
<C-S-F>, or from the Source / Format menu. The eclim equivalent is
invoked using the :JavaFormat command described below.
*:JavaFormat*
- :JavaFormat - Formats the current visual selection (or the current
line, if nothing is selected). To format the whole file, use
:%JavaFormat.
Given the following file:
>
/**
* @return
*
* Service
* for test Eclipse <C-F> formatting.
*/
public
static String
getAbstractService
()
{
if (abstractService == null)
{
throw new RuntimeException( "abstractService isn't initialized !");
}
return abstractService;
}
<
You can execute :%JavaFormat to format the code according to your
eclipse settings.
>
/**
* @return
*
* Service for test Eclipse <C-F> formatting.
*/
public static String getAbstractService() {
if (abstractService == null) {
throw new RuntimeException("abstractService isn't initialized !");
}
return abstractService;
}
<
Note: The formatting of the code is done externally with Eclipse and with
that comes a couple of caveats (|vim-issues|).
Configuration
=============
Currently source code formatting is only configurable via the eclipse
GUI. To do so, shutdown eclim, start the eclipse GUI and configure
your settings via:
>
Preferences : Java / Code Style / Formatter / Active Profile: / Edit
<
vim:ft=eclimhelp