Sublime Forum

SublimeText modelines (like vim)?

#1

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

0 Likes

#2

A plugin is the way to go - the DetectIndentation plugin does a somewhat similar thing, and it also runs via onLoad.

0 Likes

#3

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

0 Likes

#4

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.

0 Likes