[Pythonmac-SIG] Selecting in BBEdit & Python Indenting
Ryan Wilcox
ryanwilcox at mac.com
Wed Nov 30 15:57:07 CET 2005
On 11/29/05, at 9:03 PM, pythonmac-sig-request at python.org said:
>Yes, it is, but it really doesn't do python indenting quite right.
>These days, all python code really should be indented with 4 spaces,
>and while you can set BBedit to put in 4 spaces when you hit the tab
>key, it doesn't recognize those four spaces as a single level of
>indentation when you want to delete them, requiring four hits of the
>backspace key.
There's always the Shift Left and Shift Right command (under the Text menu). Yes, I know it's not a real solution, but it's better than hitting delete four times.
Hmm... another idea would be to write a script and attach it to BBEdit's Save item so that it automatically performs Detab on your source code. Write in tabs, have it automagically convert to spaces. Such a script is below:
--name this "File•Save" and put it in the
--~/Library/BBEdit/Menu Scripts
on MenuSelect(menuName, menuItem)
tell application "BBEdit"
set myName to name of document 1
if myName contains ".py" then --python file!!!!
detab text document 1 tab width 4
end if
end tell
return false --do the save operation
end MenuSelect
HTH,
_Ryan Wilcox
--
Wilcox Development Solutions: <http://www.wilcoxd.com>
Toolsmiths for the Internet Age PGP: 0x2F4E9C31
More information about the Pythonmac-SIG
mailing list