[TxMt Plugins] Re: Altering Line Endings

Rob Brackett rob at robbrackett.com
Thu Aug 9 22:58:59 UTC 2012


On Aug 9, 2012, at 2:53 PM, Allan Odgaard wrote:

> On Jul 26, 2012, at 12:12 AM, Rob Brackett <rob at robbrackett.com> wrote:
> 
>> I recently spent some time working on a plugin (https://github.com/Mr0grog/editorconfig-textmate) to support EditorConfig (http://editorconfig.org).
> 
> Neat, I didn’t know about this, looks very similar to the .tm_properties system we have in 2.0.

Yeah, I noticed the same thing after digging around a bit—at first I thought things were hard-coded in TM2 until I saw a post about tm_properties :)

It would be awesome if TM2 added native support for .editorconfig!

> 
>> […] Looking into TextMate, OakDocument has -lineEnding and -setLineEnding. Are these the right methods to call? What should I pass to them? (Calling -lineEnding always just gave me back nil whenever I tried it.)
> 
> The lineEnding property is a C enumeration:
> 
>    enum line_ending_t { kLF = 0, kCR, kCRLF };
> 
> So you should get back 0, 1, or 2 back. Normally 0 for kLF.

Awesome, that should make this pretty straightforward.

> 
>> I know all the work is happening on TM2 right now (this is currently written to work against TM1), but I'd like to get it working for both versions.
> 
> For 2.0 the internals are completely different, but it sounds like this should just be added to the current settings stuff (that already reads .tm_properties files per folder, where a line ending setting do exist).
> 
> If you haven’t heard yet, the source is now available¹, which should make it easier, should you wish to look into this.

Just saw the notice about open-sourcing it this morning. I did actually get TM2 working a few days after I sent this original e-mail; I suppose I should have sent a follow-up here. Having the source open will definitely let me see if there's a better way than what I'm currently doing, though.

Thanks!

-Rob



More information about the textmate-plugins mailing list