Modelines
Modelines for Sublime Text. Compatible with VIM and EMacs modelines.
Details
Installs
- Total 890
- Win 225
- Mac 399
- Linux 266
| Aug 18 | Aug 17 | Aug 16 | Aug 15 | Aug 14 | Aug 13 | Aug 12 | Aug 11 | Aug 10 | Aug 9 | Aug 8 | Aug 7 | Aug 6 | Aug 5 | Aug 4 | Aug 3 | Aug 2 | Aug 1 | Jul 31 | Jul 30 | Jul 29 | Jul 28 | Jul 27 | Jul 26 | Jul 25 | Jul 24 | Jul 23 | Jul 22 | Jul 21 | Jul 20 | Jul 19 | Jul 18 | Jul 17 | Jul 16 | Jul 15 | Jul 14 | Jul 13 | Jul 12 | Jul 11 | Jul 10 | Jul 9 | Jul 8 | Jul 7 | Jul 6 | Jul 5 | Jul 4 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Mac | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Linux | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 0 | 0 | 0 | 1 |
Readme
- Source
- raw.githubusercontent.com
Modelines
Set settings local to a single buffer.
A more granular approach to settings than the per file type .sublime-settings files.
Inspired by Vim’s modelines feature.
Getting Started
Recommended Installation
Use Package Control and install Modelines (compatibility starts at Sublime Text 4).
Manual Installation
Download and install Modelines.
See the installation instructions for .sublime-packages.
Side Effects
Buffers will be scanned .on_load() and .on_post_save() (by default, customizable) for modelines and settings will be set accordingly.
Settings will apply only to the buffer declaring them.
There is also a command to manually apply modelines.
Note: Application- and window-level options declared in modelines are obviously global.
Usage
How to Declare Modelines
Modelines must be declared at the top or the bottom of source code files with the following default syntax:
# ~*~ sublime: key=val; key2=val2; key3 ~*~
VIM and Emacs-style syntax are also supported.
See the settings file for (a lot) more info.
Example
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.
# ~*~ sublime: syntax=Python; tab_size=3; translate_tabs_to_spaces=false ~*~
Developer Note
To get proper completion and errors in the editor when working on this repo,
one can create a pyrightconfig.json file at the root of the repo,
containing something like this (on macOS; adjust paths accordingly depending on your environment):
{
"venvPath": ".",
"venv": "sublime-modelines",
"extraPaths": [
"/Applications/Sublime Text.app/Contents/MacOS/Lib/python38",
"/Users/YOUR_USER_NAME/Library/Application Support/Sublime Text/Lib/python38",
"/Users/YOUR_USER_NAME/Library/Application Support/Sublime Text/Packages/UnitTesting",
]
}
⚠️ The tests require the UnitTesting package.
I have not added it to dependencies.json because I don’t know how to add a dependency for tests only.
A PR is welcome if there is a way to do it.
Contributors
François Lamboley (Frizlab)
Full rewrite featuring:
- Sublime Text 4 compatibility;
- A whole new modeline syntax;
- Better VIM syntax support;
- Emacs syntax support;
- Legacy syntax support (original modeline syntax from this repo, before the rewrite).
Kay-Uwe (Kiwi) Lorenz kiwi@franka.dyndns.org
- Added VIM compatibility;
- Smart syntax matching;
- Modelines also parsed on save;
- Settings are erased from view, if removed from modeline.
Guillermo López-Anglada
- Implemented the first version of this package (for Sublime Text 2).