8

I understand how to get Eclipse to insert spaces in place of tabs, but then I'd rather not have to arrow through 12 spaces to reach an indented block.

Bonus points if there's a way to hide the spaces from the 'show whitespace characters'. I like to see whitespace characters for tabs and carriage returns, but the display gets too cluttered when spaces are also displayed.

Luke Bayes
  • 3,234
  • 2
  • 25
  • 20
  • So you want to use spaces instead of tabs, but you want them to behave like tabs? If you want tabs, use tabs. – GalacticCowboy Jul 17 '09 at 00:37
  • Do you mean "to insert spaces instead of tabs" – Rich Seller Jul 17 '09 at 06:12
  • There are some good reasons to use spaces instead of tabs and I agree with most of them. The only problem I have with spaces over tabs, is being forced (in this tool) to either use awkward key combinations or press the arrow keys four times more frequently. – Luke Bayes Jul 18 '09 at 19:19
  • "spaces for tabs?" Yes I did, thanks for the clarification! – Luke Bayes Jul 18 '09 at 19:20

3 Answers3

6

Try CTRL+[right,left] arrow key. Certainly one of my most-used combos.

Not Sure
  • 5,873
  • 3
  • 23
  • 29
  • +1 - I'm not very familiar with Eclipse, but this sounds like the right answer for any "sane" IDE. It sounds like the OP is trying to solve a problem that doesn't exist, without using the tools already at his disposal. – GalacticCowboy Jul 17 '09 at 00:46
  • Heh - I do this by default but had to think about it :) +1 – javamonkey79 Jul 17 '09 at 00:50
  • On OS X I have ALT+Arrow or CMD+Arrow. Both of which are helpful but have different behavior from arrowing past a single tab. Alt goes to the beginning/end of the nearest word, and CMD goes to the beginning/end of the current line. The ALT implementation is especially bad, because if you're at the left edge of a line, and ALT+Right, it moves the cursor to the *end* of the first word. The TextMate editor treats collections of spaces just like tabs, so this isn't some imaginary solution. – Luke Bayes Jul 18 '09 at 19:16
  • You are not addressing the problem: He wants X spaces to be treated the same as a single tab character. Jumping to the beginning/end of the line is just a crude workaround. These are 2 very useful keyboard shortcuts, but not very useful if you normally would use tabs to, say, line up variable definitions. – bjornl Jun 25 '12 at 04:23
2

As it turns out, this appears to not be possible in Eclipse.

Luke Bayes
  • 3,234
  • 2
  • 25
  • 20
  • Does "Not Sure"s answer not answer your question? – Tyler Aug 24 '09 at 06:53
  • Not really - I commented below his answer with more details. What I was looking for was a configuration option that allowed me to simply press arrow keys (not key combinations) to move past each set of four spaces exactly as if they were a tab. This works great in TextMate, and allows one to take advantage of the benefits of spaces over tabs, without suffering the biggest drawback of spaces. – Luke Bayes Aug 29 '09 at 23:40
1

With the next Eclipse 20199.12/4.14, that might actually be possible! (albeit ten years later)

See "Backspace/delete can treat spaces as tabs"

If you use the Insert spaces for tabs option, now you can also change the backspace and delete keys behavior to remove multiple spaces at once, as if they were a tab.

The new setting is called Remove multiple spaces on backspace/delete and is found on the General > Editors > Text Editors preference page.

https://www.eclipse.org/eclipse/news/4.14/images/delete-spaces-as-tabs.png

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Nice. Unfortunately using an Eclipse-based Embedded-IDE I will only enjoy this feature several years from now. :'/ –  Oct 15 '19 at 13:05