Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I use an Eclipse formatter profile in VIm?

My team has a standard Eclipse code formatter profile. I prefer to work with VIm. Is there any way I can convert this file and use it with VIm?

like image 283
Sam Jones Avatar asked Aug 20 '10 03:08

Sam Jones


People also ask

How do I import a formatter into STS?

Go to Window --> Preferences. Then select Java --> Code Style --> Formatter and click on the Import... button.

How do I change line width in eclipse?

Go to the "Comments" tab, and on the bottom there's the field "Line width" to change the maximum line width for comments.


1 Answers

You could probably just configure vim to run the formatter automatically when writing your files.

Formatter invocation from the commandline (google):

<path-to-eclipse>\eclipse.exe -vm <path-to-vm>\java.exe -application
org.eclipse.jdt.core.JavaCodeFormatter -verbose -config
<path-to-config-file>\org.eclipse.jdt.core.prefs
<path-to-your-source-files>\*.java

Tip: with expand("%:p") you can get the full path to your file...

I hope this helps!

like image 178
akosch Avatar answered Nov 08 '22 12:11

akosch