Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm running lisa mint 3.0.0-12-generic with gnome 3.2.1 as my Desktop Environment. Whenever I open my python 2.7.2 interactive interpreter to try out some code snippets, using the tab-key has strange behavior.

I'll start a loop or any kind of nested expression:

>>> while True:
>>>     if this == that:    /-- > this indents with tab 4-spaces
>>>             for i in that:  /-- > this line will indent using tab 8-spaces??

I've been searching around and have been finding this isn't controlled by python but, by the windowing system on my OS. Is there a specific configuration file to edit in gnome that will change the way the tab-key indents?

share|improve this question

1 Answer 1

The terminal tab count start from column 1, and it is 8 spaces per tab.

You thought 1st tab is 4 spaces because you start counting from where you start typing. If you count ">>> " plus 4 spaces, the 1st tab is actually 8 spaces.

You will see it is 8 spaces for 2rd tab and so on.

Tab width in terminal screen can be changed to 4 following command

tabs -4

You can change 4 to any number you like.

However, that doesn't work inside python shell. The python shell must has its own tab setting.

share|improve this answer
    
if you are using gnome terminal, check the profile setting. –  John Siu Nov 11 '12 at 3:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.