Home Download Buy Blog Forum Support

SublimeText modelines (like vim)?

SublimeText modelines (like vim)?

Postby guillermooo on Mon Feb 08, 2010 5:07 pm

Hi,

I've whipped up a small plugin that looks for "modelines" in individual files onLoad and sets options locally to that file. Is there a built-in feature like this in SublimeText or is a plugin the right way to go?

Cheers,
Guillermo
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: SublimeText modelines (like vim)?

Postby jps on Tue Feb 09, 2010 1:00 am

A plugin is the way to go - the DetectIndentation plugin does a somewhat similar thing, and it also runs via onLoad.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm

Re: SublimeText modelines (like vim)?

Postby guillermooo on Tue Feb 09, 2010 1:11 pm

Good!

Jon, I don't think there's a way of detecting whether a given name corresponds to a valid (built-in) option? I mean, as far as I understand, there are predefined application options which control certain built-in features and user-defined options with arbitrary names?

Cheers,
Guillermo
guillermooo
 
Posts: 729
Joined: Thu Jul 23, 2009 9:06 am

Re: SublimeText modelines (like vim)?

Postby jps on Wed Feb 10, 2010 11:50 am

Your best bet is to do view.options().get('foo'), and if it returns None, then it shouldn't be used by anything. Every inbuilt option bar one or two are specified in Default File Type.sublime-options.
jps
Site Admin
 
Posts: 3077
Joined: Wed Mar 19, 2008 12:33 pm


Return to Ideas and Feature Requests

Who is online

Users browsing this forum: Google [Bot] and 8 guests