Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > BBEdit Indentation

BBEdit Indentation
Thread Tools
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Aug 10, 2005, 01:20 PM
 
Does anybody know how to get BBEdit to automatically create indents in a document of source code to indicate the beginning and ending of a function? I know that emacs does this, but I'm sure there must be a way to do this in BBEdit too....

Anybody?
     
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Aug 10, 2005, 06:27 PM
 
I've never used emacs, so I'm not really sure what exactly you're asking... But BBEdit has an auto-indent option, that for example if the line you are on is indented 5 tabs, pressing enter will take you to the next line, pre-indented 5 tabs. I'm not sure if this is what you mean or not.
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
Clinically Insane
Join Date: Mar 2001
Location: yes
Status: Offline
Reply With Quote
Aug 10, 2005, 09:36 PM
 
Originally Posted by madmacgames
I've never used emacs, so I'm not really sure what exactly you're asking... But BBEdit has an auto-indent option, that for example if the line you are on is indented 5 tabs, pressing enter will take you to the next line, pre-indented 5 tabs. I'm not sure if this is what you mean or not.
Not exactly.. what I"m looking for is a feature that will take a document like this:

[php]
myfunction () {
for ($x=0; $x < 20; $x++) {
print "hello";
}
}
[/php]

and transform it to:

[php]
myfunction () {
for ($x=0; $x < 20; $x++) {
print "hello";
}
}
[/php]
     
Fresh-Faced Recruit
Join Date: Sep 2000
Location: Hanover, NH, USA
Status: Offline
Reply With Quote
Aug 14, 2005, 12:14 PM
 
I don't think BBEdit supports syntax-aware indenting, at least I never figured out how to do it. But then, I haven't used the latest version of BBEdit since I switched to TextWrangler when became free.

One thing you could do is write a perl or python script that does it. BBEdit allows scripts to be run on the current selection or the entire file and it pastes the script's output back to the file.
     
Professional Poster
Join Date: Oct 2000
Location: Toronto, ON
Status: Offline
Reply With Quote
Aug 14, 2005, 09:30 PM
 
Other than checking the "auto indent" checkbox?


Or does that not do what you're after?
The Lord said 'Peter, I can see your house from here.'
     
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Aug 14, 2005, 10:52 PM
 
>> Or does that not do what you're after?

No, it doesn't, though I don't really see why not having the feature would be a problem if you indent while coding, which most people do.

The only time I could see maybe needing it would be if you downloaded a PHP file that the programmer did not indent, which in my 3+ years of working with PHP has been never.
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
Professional Poster
Join Date: Oct 2000
Location: Toronto, ON
Status: Offline
Reply With Quote
Aug 16, 2005, 07:03 AM
 
OK, I missed an important detail in besson's post above

Sounds like you want Tidy, which can be had in many flavours:
http://www.geocities.com/terry_teague/tidy.html
http://tidy.sourceforge.net/
http://www.coggeshall.org/oss/tidy/
The Lord said 'Peter, I can see your house from here.'
     
Grizzled Veteran
Join Date: Jan 2001
Location: usa
Status: Offline
Reply With Quote
Aug 16, 2005, 06:55 PM
 
BBEdit has tidy built in. Not sure what kind of code you can run it on other than HTML/XML.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:25 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2