Modelines
Modelines for Sublime Text. Compatible with VIM and EMacs modelines.
Details
Installs
- Total 878
- Win 223
- Mac 397
- Linux 258
| Jul 1 | Jun 30 | Jun 29 | Jun 28 | Jun 27 | Jun 26 | Jun 25 | Jun 24 | Jun 23 | Jun 22 | Jun 21 | Jun 20 | Jun 19 | Jun 18 | Jun 17 | Jun 16 | Jun 15 | Jun 14 | Jun 13 | Jun 12 | Jun 11 | Jun 10 | Jun 9 | Jun 8 | Jun 7 | Jun 6 | Jun 5 | Jun 4 | Jun 3 | Jun 2 | Jun 1 | May 31 | May 30 | May 29 | May 28 | May 27 | May 26 | May 25 | May 24 | May 23 | May 22 | May 21 | May 20 | May 19 | May 18 | May 17 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Windows | 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 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| Mac | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 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 | 1 |
| Linux | 0 | 0 | 0 | 0 | 0 | 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 |
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).