views:

304

answers:

2

I am running IronPython 2.0.2 interactive console with Mono 2.4 on OSX Terminal.app . How do I insert indent/tab in the Terminal.app ? I want to do this so I can indent my code.

For example I want to input

print "hello    tab"
what I see is
print "hellotab"
despite pressing the tab key many times. When the command gets executed it prints hellotab. Another weird behavior is that after pressing tab a bunch of time and then press delete the tabs shows up, but cannot be removed, and ipy still prints hellotab .

I tried inserting tabs with IronRuby (ir.exe) and I don't see the tab showing up when I press it, but it is displayed when the command is executed.

+3  A: 

You should be able to insert a tab character with:

print "hello\ttab"

Although what you have above should work if you use a raw string, for instance:

print r"hello    tab"

Let me know if this is what you were after.

Jweede
Sorry, this is not what I am looking for. I tested \t and it doesn't print out. I want to insert tab so I can indent my code.
phi
A: 

Look at the Terminal menu, Preferences... menu item.

In the Preferences dialog box, click on the Settings selection.

Within the settings, click on the Keyboard tab.

You have probably modified your tab key to not work correctly. It should not be mentioned as a special key and should generate an ordinary tab character.

Also, run a stty -a command in your Terminal tool. Someone may have changed your oxtabs setting or mapped tab (^I) to something unexpected.

S.Lott
I don't see an option to map the tab key in Terminal->Preference->Keyboard. stty -a did not show that ^I was remaped
phi