1

Many editors and IDEs support converting spaces into tabs by using Tab/Shift+Tab on a line or a selected text fragment, but I've not found such a feature in Eclipse. Is there a plugin or something to add such functionality? I've tried to find one myself, but it doesn't seem to have any by keywords like "tab" or "indent". I'm working with Perl, BTW.

ZzZombo
  • 1,082
  • 1
  • 11
  • 26
  • Possible duplicate of [How do I change Eclipse to use spaces instead of tabs?](http://stackoverflow.com/questions/407929/how-do-i-change-eclipse-to-use-spaces-instead-of-tabs) – morotspaj Nov 07 '16 at 11:19
  • For god's sake, read before accusing of duplicating. I asked specifically about a way to replicate a quite widely provided feature, triggered by Tab/Shift+Tab... – ZzZombo Nov 07 '16 at 11:55

2 Answers2

3

Check if the context menu has an entry like Source->Correct Indentation. That is available for Java, but the availability depends on the language you edit.

Otherwise you can install the AnyEdit Tools plugin which provides a command to convert the selection from tabs to spaces and vice versa.

Bananeweizen
  • 21,797
  • 8
  • 68
  • 88
0

If you change settings to tabs only or spaces only, Tab, Shift + Tab works as expected. (At least for me).

morotspaj
  • 1,400
  • 11
  • 26
  • I just tried again. I copied some code from Internet, with spaces as indentation, while I use tabs, and all lines starting with spaces completely refused to be unintended, while pressing Tab only adds a tab character after the spaces. So it doesn't convert spaces to tabs at all. – ZzZombo Nov 07 '16 at 12:53
  • Which language? Java? – morotspaj Nov 07 '16 at 13:05
  • What happens if you press Ctrl + i? – morotspaj Nov 07 '16 at 13:10
  • Language is Perl. If I press it, I get text selection replaced by a single tab. – ZzZombo Nov 07 '16 at 13:15