Indenting style in snippets (was: [SVN] Bundle commit 576)

Allan Odgaard allan at macromates.com
Mon Apr 11 10:16:40 UTC 2005


On Apr 11, 2005, at 9:13, Chris Thomas wrote:

> 1. Mac OS X's version of indent does not seem to have an option to 
> output tabs instead of spaces.

Crap, and OS X's unexpand doesn't take a tab size, how nice! ;) 
However, while I did mention 'indent', this tool strikes me as 
something which may have been useful 10 years ago -- most likely I'd 
have to include my own indent tool with TextMate which handles the 
things we're interested in (but the user would be able to substitute 
this for whatever he wanted).

Personally I also write snippets like this:
    {$0
    }

I'm quite sure indent would turn it into:
    {
       $0
    }

> 2. There are lots of args to indent to specify preferred styles. 
> Ultimately need a prefs panel to simplify this task, probably with a 
> popup containing common option sets.

Yeah... not sure exactly how to solve this (especially since I probably 
want this in the style sheets, see next item). Most likely I will need 
some sort of GUI/wizard to create/edit style sheets (which btw 
desperately need a better name), so such GUI could make this easer -- 
this is something that'll need a bit of trial-and-error (with regard to 
all settings). While the style sheets are very simple and extremely 
flexible, I'm quite sure a lot of people won't get a good first 
impression of TM if changing tab size involves opening up a style sheet 
and entering “source { tab-size: 4; }” ;)

> 3. Users might want to use different styles in different files. For 
> example, if I'm working on FSF source code, the style has to be 
> <strike>atrocious</strike> GNU-compliant, but I would normally use 
> BSD-style.

I imagine the setting should be placed in the style sheet, this allows 
one to easily switch “profile” (a profile is just a list of which style 
sheets to use) and it further allows context specific setting of the 
snippet post-processor (e.g. we need it for source.php but not in 
text.html, or a different set of options or command for source.ruby).

Additionally it should probably be possible to disable pre-processing 
per snippet.




More information about the textmate-dev mailing list