FANDOM


(Change to TipImported template + severe manual clean)
(Change <tt> to <code>, perhaps also minor tweak.)
 
(4 intermediate revisions by 4 users not shown)
Line 3: Line 3:
 
|previous=699
 
|previous=699
 
|next=701
 
|next=701
|created=April 14, 2004
+
|created=2004
 
|complexity=basic
 
|complexity=basic
 
|author=dunamin
 
|author=dunamin
 
|version=5.7
 
|version=5.7
 
|rating=6/9
 
|rating=6/9
  +
|category1=Indenting
  +
|category2=Java
 
}}
 
}}
 
I needed to do a few tweaks to vimrc to get Java code looking smooth in Vim.
 
I needed to do a few tweaks to vimrc to get Java code looking smooth in Vim.
Line 46: Line 48:
   
 
----
 
----
Also, in [http://www.cygwin.com/ cygwin], there's a program called "astyle" which properly indents Java programs, just like cb or indent do for C programs.
+
Also, in [http://www.cygwin.com/ cygwin] or UNIX-based systems, there's a program called "astyle" which properly indents Java programs, just like cb or indent do for C programs.
   
 
----
 
----
Prefer using <tt>:setlocal</tt> from a java ftplugin if you do not want to pollute all types of files with Java settings.
+
Prefer using <code>:setlocal</code> from a java ftplugin if you do not want to pollute all types of files with Java settings.
   
 
----
 
----
[[Category:Indenting]]
 
[[Category:Java]]
 

Latest revision as of 05:44, July 13, 2012

Tip 700 Printable Monobook Previous Next

created 2004 · complexity basic · author dunamin · version 5.7


I needed to do a few tweaks to vimrc to get Java code looking smooth in Vim.

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

CommentsEdit

Also you can use

let java_comment_strings=1
let java_highlight_java_lang_ids=1

See help on java syntax highlighting file :help java.


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

Also, in cygwin or UNIX-based systems, there's a program called "astyle" which properly indents Java programs, just like cb or indent do for C programs.


Prefer using :setlocal from a java ftplugin if you do not want to pollute all types of files with Java settings.


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