tags:

views:

24

answers:

1

I have a silly use case for eclipse:

At work, they use 2 spaces for a tab character. Indentation looks really squashed and I'm finding it obstructs readability.

Now, I can't set Eclipse to use 4 spaces for a tab as it'll edit any files I change, and obviously don't want to violate the coding standards.

So, can I have a custom view onto my document, with saving maintaining the original spacing?

Cheers

+1  A: 

(Not exactly an "eclipse" answer, but it can work)
Combine your source code with a SCM like git, where you can define a custom filter driver with a smudge/clean process:

alt text

Each time you checkout and fill your working directory, all .java files will be written with 4 spaces.
But each time you commit them, they will be stored with 2 spaces.

Then, whatever current VCS you are using (SVN, Perforce, ...) will take those (git) commit files and will commit them in turn (but with the right format).
Since you can embed a Git repo inside any workspace of any other central VCS, this can be easy to setup.

VonC
Thanks a lot. I'll check it out, seems an awesome solution!
Steven Sproat