Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse multi-line indent uses tabs instead of spaces (pydev)

Tags:

When I highlight a block of text in Eclipse, and press TAB, it inserts a tab at the head of each line. I want it to insert 4 spaces instead.

I need to do this on a files with a custom extension: *.shpaml

I have PyDev installed.

like image 465
zzz Avatar asked Jan 25 '12 19:01

zzz


People also ask

How do I indent multiple lines in Eclipse?

Select all, then do Ctrl + I . The advantage of this method over selecting some lines, then pressing Tab , is that it is much faster to do Ctrl + A then Ctrl + I , than tabbing lines at a time.

Does PyDev have auto indentation?

Although auto-indentation is not a feature of PyDev because of the language design you should be able to indent with a simple tab. Just select the lines you want to indent and press Tab. If you want to unindent lines you have to press Shift+Tab.


2 Answers

I'm considering that *.shpaml is opened with the PyDev editor...

There are 2 preferences related to that:

In window > preferences > PyDev > Editor, you can choose 'replace tabs with spaces when typing?' and in that same page 'assume tab spacing when file contains tabs?'.

So, probably you have both checked and your *.shpaml has some tab in it, which makes PyDev work with tabs... if you uncheck the 'assume tab spacing when file contains tabs?', it should do what you want.

like image 94
Fabio Zadrozny Avatar answered Sep 28 '22 22:09

Fabio Zadrozny


You should be able to set "spaces instead of tabs" here:

  Eclipse, Window, Preferences, General, Editors, Text Editors,
      Insert spaces for tabs=Y
like image 27
paulsm4 Avatar answered Sep 28 '22 20:09

paulsm4