Loading ...
Sorry, an error occurred while loading the content.

179Re: Automatic indentation

Expand Messages
  • michael_j_barber
    Apr 24, 2008
      --- In SubEthaEdit@yahoogroups.com, "Gus" <jim@...> wrote:
      > Maybe I'm the only one who would find this useful, but...
      > I'd like to be able to select a bunch of badly formatted code and let
      > SEE "auto-indent" it. The function would not have to be perfect.
      > Sometimes I have to work with long lines of unreadable Javascript /
      > PHP and a function that would automatically indent what's between
      > {brackets} would help greatly.

      What you're describing is often called a "code beautifier" or a "pretty printer". There are
      quite a few out there, especially for languages with a C-style syntax. For Javascript and
      PHP, you might find <http://elfz.laacz.lv/beautify/> or <http://www.prettyprinter.de/>
      useful. Google around a bit with the above terms, and I'm sure you'll find many more.

      Getting a code beautifier (in the form of a shell filter ) into SubEthaEdit is actually pretty
      easy. I put together the needed scripts and blogged about them here:
      subethaedit.html>. Short summary is that one script provides a general preferences
      system for the modes, which you use to define the formatters. Another script invokes the
      specified formatter for a document, either reformatting the selection or the entire
      document, if the selection is empty. See the blog post for details and download

      Hope that helps,
    • Show all 3 messages in this topic