FANDOM


(reviewed)
(typos)
Line 1: Line 1:
[[Category:Java]]
+
   
 
{{Tip
 
{{Tip
Line 10: Line 10:
 
|rating=6/9
 
|rating=6/9
 
|text=
 
|text=
I needed to do a few tweaks to .vimrc get Java code looking smooth in vim and I'm passing the joy. This is probably good for at least 80% of Java programmers. Hope this helps my fellow Java/Vim peeps.
+
I needed to do a few tweaks to .vimrc to get Java code looking smooth in vim and I'm passing the joy. This is probably good for at least 80% of Java programmers. Hope this helps my fellow Java/Vim peeps.
   
 
Randy Solomonson
 
Randy Solomonson
Line 20: Line 20:
 
set si
 
set si
 
set shiftwidth=4
 
set shiftwidth=4
"Java annonymous classes. Sometimes, you have to use them.
+
"Java anonymous classes. Sometimes, you have to use them.
 
set cinoptions+=j1
 
set cinoptions+=j1
   
Line 55: Line 55:
 
----
 
----
 
<!-- parsed by vimtips.py in 0.474011 seconds-->
 
<!-- parsed by vimtips.py in 0.474011 seconds-->
  +
  +
  +
[[Category:Java]]

Revision as of 20:59, July 20, 2007


Previous TipNext Tip

Tip: #700 - Indenting for Java

Created: April 14, 2004 23:58 Complexity: basic Author: dunamin--AT--sbcglobal.net Version: 5.7 Karma: 6/9 Imported from: Tip#700

I needed to do a few tweaks to .vimrc to get Java code looking smooth in vim and I'm passing the joy. This is probably good for at least 80% of Java programmers. Hope this helps my fellow Java/Vim peeps.

Randy Solomonson

My .vimrc file:

"Take care of indents for Java. 
set autoindent 
set si 
set shiftwidth=4 
"Java anonymous classes. Sometimes, you have to use them. 
set cinoptions+=j1

Comments

Also you can use let java_comment_strings=1 let java_highlight_java_lang_ids=1

Get help on java syntax highlighting file: :help java

alexander_kurilovich--AT--hotmail.com , April 15, 2004 2:30


I use these settings too:

let java_mark_braces_in_parens_as_errors=1 
let java_highlight_all=1 
let java_highlight_debug=1 
let java_ignore_javadoc=1 
let java_highlight_java_lang_ids=1 
let java_highlight_functions="style" 
let java_minlines = 150 

Anonymous , April 15, 2004 6:34


Also, in cygwin (www.cygwin.com), there's a program called "astyle" which properly indents Java programs, just like cb or indent do for C programs.

lyle_z--AT--hotmail.com , March 9, 2005 15:14


Community content is available under CC-BY-SA unless otherwise noted.