Treat groups of n consecutive spaces like a tab?
Posted: Thu May 25, 2006 11:34 pm
Hi,
I'd like to convert all of my Python code to use 4 spaces instead of tabs (this is good Python coding style). I'll probably do a find & replace on all my Python files, and then I'll set the "convert new tabs to spaces" checkbox for my Python class in Textpad. No problem.
The thing is, I like the convenience of being able to jump back and forth between different levels of indentation with just a single left or right arrow key press, or a single press of the backspace key. If I switch to spaces instead of tabs, I'll lose that convenience. What previously took a single keypress will now require 4.
Is there any way to get Textpad to treat a group of (n=4 in my case) consecutive spaces as it would a single tab? What I'd like is:
1) If the cursor is followed by n or more spaces, and I hit the right arrow key, the cursor will jump forward n columns.
2) If the cursor is preceded by n or more spaces, and I hit the left arrow key, the cursor will jump backwards n columns.
3) If the cursor is preceded by n or more spaces, and I hit the backspace key, the preceding n spaces will be deleted and the cursor will jump backwards n columns.
The fourth obvious item would be to have a tab keypress generate n spaces, but Textpad already does that.
Any tips or workarounds would be greatly appreciated.
Cheers,
Martin
I'd like to convert all of my Python code to use 4 spaces instead of tabs (this is good Python coding style). I'll probably do a find & replace on all my Python files, and then I'll set the "convert new tabs to spaces" checkbox for my Python class in Textpad. No problem.
The thing is, I like the convenience of being able to jump back and forth between different levels of indentation with just a single left or right arrow key press, or a single press of the backspace key. If I switch to spaces instead of tabs, I'll lose that convenience. What previously took a single keypress will now require 4.
Is there any way to get Textpad to treat a group of (n=4 in my case) consecutive spaces as it would a single tab? What I'd like is:
1) If the cursor is followed by n or more spaces, and I hit the right arrow key, the cursor will jump forward n columns.
2) If the cursor is preceded by n or more spaces, and I hit the left arrow key, the cursor will jump backwards n columns.
3) If the cursor is preceded by n or more spaces, and I hit the backspace key, the preceding n spaces will be deleted and the cursor will jump backwards n columns.
The fourth obvious item would be to have a tab keypress generate n spaces, but Textpad already does that.
Any tips or workarounds would be greatly appreciated.
Cheers,
Martin