Modelines
Modelines for Sublime Text. Compatible with VIM and EMacs modelines.
Details
Installs
- Total 864
- Win 219
- Mac 390
- Linux 255
| Apr 5 | Apr 4 | Apr 3 | Apr 2 | Apr 1 | Mar 31 | Mar 30 | Mar 29 | Mar 28 | Mar 27 | Mar 26 | Mar 25 | Mar 24 | Mar 23 | Mar 22 | Mar 21 | Mar 20 | Mar 19 | Mar 18 | Mar 17 | Mar 16 | Mar 15 | Mar 14 | Mar 13 | Mar 12 | Mar 11 | Mar 10 | Mar 9 | Mar 8 | Mar 7 | Mar 6 | Mar 5 | Mar 4 | Mar 3 | Mar 2 | Mar 1 | Feb 28 | Feb 27 | Feb 26 | Feb 25 | Feb 24 | Feb 23 | Feb 22 | Feb 21 | Feb 20 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 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 |
| Mac | 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 |
| 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 | 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).