In a .py doc, when I type the line
while True:
or
def xxx():
or
if:
etc.
I expect the next line to be indented 4 spaces. But it's not indented at all. How can I set this?
Thanks
Not getting expected indentation with python scripts
Moderators: AmigoJack, bbadmin, helios, MudGuard
- Dick7
- Posts: 24
- Joined: Mon Feb 02, 2004 6:55 am
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
TextPad's automatic indentation only works with C-like languages. In the help, under How to | Customize Settings | Document Properties you will see:
To enter a newline and increase the indentation::
<Enter> <Space> <Space> <Space> <Space>
To enter a newline and reduce the indentation::
<Enter> <Backspace> <Backspace> <Backspace> <Backspace>
But you can achieve some of what you want by recording two macros and giving them convenient keyboard shortcuts:Automatically indent blocks
Indent a new line following a line ending with {, and reduce the indentation of a } on a line on its own. Maintain Indentation must also be set.
To enter a newline and increase the indentation::
<Enter> <Space> <Space> <Space> <Space>
To enter a newline and reduce the indentation::
<Enter> <Backspace> <Backspace> <Backspace> <Backspace>
- Dick7
- Posts: 24
- Joined: Mon Feb 02, 2004 6:55 am
Thanks for the info.ben_josephs wrote:TextPad's automatic indentation only works with C-like languages. In the help, under How to | Customize Settings | Document Properties you will see:But you can achieve some of what you want by recording two macros and giving them convenient keyboard shortcuts:Automatically indent blocks
Indent a new line following a line ending with {, and reduce the indentation of a } on a line on its own. Maintain Indentation must also be set.
To enter a newline and increase the indentation::
<Enter> <Space> <Space> <Space> <Space>
To enter a newline and reduce the indentation::
<Enter> <Backspace> <Backspace> <Backspace> <Backspace>
I can't seem to find how to assign keyboard shortcuts to macros..
Dick
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm