ctrl+shift+p filters: :st2 :st3 :win :osx :linux
Browse

Modelines

by SublimeText ST2

Vim-like modelines for Sublime Text.

Details

  • 2012.09.13.23.27.49
  • github.​com
  • github.​com
  • 12 years ago
  • 1 hour ago
  • 12 years ago

Installs

  • Total 861
  • Win 218
  • Mac 388
  • Linux 255
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 29 Feb 28 Feb 27 Feb 26 Feb 25 Feb 24 Feb 23 Feb 22 Feb 21 Feb 20 Feb 19 Feb 18 Feb 17 Feb 16 Feb 15 Feb 14
Windows 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
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 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

Sublime Modelines

Set settings local to a single buffer. A more granular approach to settings than the per file type .sublime-settings files.

Inspired in Vim's modelines feature.

Getting Started

Download and install SublimeModelines.

See the installation instructions for .sublime-packages.

Side Effects

Buffers will be scanned .on_load() for modelines and settings will be set accordingly. Settings will apply only to the buffer declaring them.

Usage

How to Declare Modelines

Modelines must be declared at the top or the bottom of source code files with one of the following syntaxes:

# sublime: option_name value
# sublime: option_name value; another_option value; third_option value

Note: # is the default comment character. Use the corresponding single-line comment character for your language. When there isn't a concept of comment, the default comment character must be used.

How to Define Comment Characters in Sublime Text

SublimeModelines finds the appropriate single-line comment character by inspecting the shellVariables preference, which must be defined in a .tmPreferences file. To see an example of how this is done, open Packages/Python/Miscellaneous.tmPreferences.

Many packages giving support for programming languages already include this, but you might need to create a .tmPreferences file for the language you're working with if you want SublimeModelines to be available.

Caveats

If the option's value contains a semicolon (;), make sure it isn't followed by a blank space. Otherwise it will be interpreted as a multioption separator.

Non-Standard Options

For some common cases, no directly settable option exists (for example, a setting to specify a syntax). For such cases, Sublime Modelines provides non-standard accessors as a stop-gap solution.

x_syntax Packages/Foo/Foo.tmLanguage

Sets the syntax to the specified .tmLanguage file.