@@ -10,7 +10,7 @@ Inspired by Vim’s modelines feature.
1010
1111### Recommended Installation
1212
13- Use Package Control and install ` SublimeModelines ` .
13+ Use Package Control and install ` SublimeModelines ` (compatibility starts at Sublime Text 4) .
1414
1515### Manual Installation
1616
@@ -21,61 +21,47 @@ See the [installation instructions](<https://docs.sublimetext.io/guide/extensibi
2121
2222## Side Effects
2323
24- Buffers will be scanned ` .on_load() ` for modelines and settings will be set accordingly.
24+ Buffers will be scanned ` .on_load() ` and ` .on_post_save() ` (by default, customizable) for modelines and settings will be set accordingly.
2525Settings will apply ** only** to the buffer declaring them.
2626
27+ There is also a command to manually apply modelines.
28+
2729** Note** : Application- and window-level options declared in modelines are obviously global.
2830
2931
3032## Usage
3133
3234### How to Declare Modelines
3335
34- Modelines must be declared at the top or the bottom of source code files with one of the following syntaxes :
36+ Modelines must be declared at the top or the bottom of source code files with the following default syntax :
3537
3638``` text
37- # sublime: option_name value
38- # sublime: option_name value; another_option value; third_option value
39+ # ~*~ sublime: key=val; key2=val2; key3 ~*~
3940```
4041
41- ** Note** :
42- ` # ` is the default comment character.
43- Use the corresponding single-line comment character for your language.
44- When there isn't a concept of comment, the default comment character must be used.
45-
46- ### How to Define Comment Characters in Sublime Text
47-
48- SublimeModelines finds the appropriate single-line comment character by inspecting the ` shellVariables ` preference,
49- which must be defined in a ` .tmPreferences ` file.
50- To see an example of how this is done, open ` Packages/Python/Miscellaneous.tmPreferences ` .
51-
52- Many packages giving support for programming languages already include this,
53- but you might need to create a ` .tmPreferences ` file for the language you're working with
54- if you want SublimeModelines to be available.
55-
56-
57- ## Caveats
42+ VIM and Emacs-style syntax are also supported.
43+ See the settings file for (a lot) more info.
5844
59- If the option’s value contains a semicolon (` ; ` ), make sure it isn't followed by a blank space.
60- Otherwise it will be interpreted as a multi-option separator.
6145
46+ ## Example
6247
63- ## Non-Standard Options
64-
65- For some common cases, no directly settable option exists (for example, a setting to specify a syntax).
66- For such cases, Sublime Modelines provides non-standard accessors as a stop-gap solution.
48+ This is a simple example, that disable tabs auto-translation to spaces, set the tab size to 3 and set the file syntax to Python.
6749
6850``` text
69- # sublime: x_syntax Foo
70- or
71- # sublime: x_syntax Packages/Foo/Foo.tmLanguage
51+ # ~*~ sublime: syntax=Python; tab_size=3; translate_tabs_to_spaces=false ~*~
7252```
7353
74- Sets the syntax to the specified ` .tmLanguage ` file.
75-
7654
7755# Contributors
7856
57+ [ François Lamboley (Frizlab)] ( < https://github.com/Frizlab > ) :
58+ - Full rewrite featuring:
59+ - Sublime Text 4 compatibility;
60+ - A whole new modeline syntax;
61+ - Better VIM syntax support;
62+ - Emacs syntax support;
63+ - Legacy syntax support (original modeline syntax from this repo, before the rewrite).
64+
7965[ Guillermo López-Anglada] ( < https://github.com/guillermooo > ) :
8066- Implemented the first version of this package (for Sublime Text 2).
8167
@@ -84,7 +70,3 @@ Kay-Uwe (Kiwi) Lorenz <kiwi@franka.dyndns.org> (<http://quelltexter.org>):
8470- Smart syntax matching;
8571- Modelines also parsed on save;
8672- Settings are erased from view, if removed from modeline.
87-
88- [ Frizlab] ( < https://github.com/Frizlab > ) :
89- - Removed VIM compatibility (use ` VimModelines ` if you need that);
90- - Modernize/clean the project, and make sure it works with SublimeText 4.
0 commit comments