D&C GLug - Home Page

[ Date Index ] [ Thread Index ] [ <= Previous by date / thread ] [ Next by date / thread => ]

[LUG] Java, VIM, tabs, spaces and indents

 

Hello everyone.
I'm now doing java in my computer science course. Much to my irratation, 
I have discovered that java is poorly designed language which makes all 
code indented by an extra level because of the class definitions.

I would just keep using 8 space indents like I do with C, but this extra 
level makes it just too much.

Also, my code has to pass a style check to get certain marks. This 
enforces a maximum of 4 space indents, and won't let me have tabs either 
(though with 4 space indents these would end up a mess anyway).

After about 5 mins of coding with soft tabs I had had enough. How on 
earth does anyone put up with it? Maybe this is why we've ended up with 
the disaster that is the 2-space GNU coding standards.

So how can I setup vim to mess with the spaces for me?
With softtabstop set to 4 I can backspace over groups of 4 spaces as if 
they were tab characters (so long as they are in a mod4 column). But the 
delete and arrow keys still treat them as spaces.

I think the best way of doing this would be to get vim to convert spaces 
to tabs as the file is read, set the tabstop to 4, and then convert them 
back into spaces when the file is written.

Any ideas? Anyone else who uses java: how do you deal with this issue?

Thanks
Simon

-- 
The Mailing List for the Devon & Cornwall LUG
http://mailman.dclug.org.uk/listinfo/list
FAQ: http://www.dcglug.org.uk/linux_adm/list-faq.html