Sublime Alignment

Install Open Source

Dead-simple alignment of multi-line selections and multiple selections for Sublime Text.

Features

See the screenshots below for examples of the plugin in action.

Works On

  • OS X
  • Windows
  • Linux

Screenshots

Installation

Download Package Control and use the Package Control: Install Package command from the command palette. Using Package Control ensures Alignment will stay up to date automatically.

Usage

  1. Make a multi-line selection, or multiple selections
  2. Press ctrl+alt+a on Windows and Linux, or cmd+ctrl+a on OS X

When using with a multi-line selection, the lines will be indented consistently first. If the selected lines are consistently indented, the first = on each line will be aligned. The character to align to for mid-line alignment can be configured via the settings.

Package Settings

The default settings can be viewed by accessing the Preferences > Package Settings > Alignment > Settings – Default menu entry. To ensure settings are not lost when the package is upgraded, make sure all edits are saved to Settings – User.

align_indent
A boolean (true or false) setting that controls if a multi-line selection should have its indent level aligned.
Default: true
mid_line_tabs
A boolean (true or false) setting that controls if mid-line alignment should be done using tabs if the current file is set to use tabs for indentation. Please note that this settings may cause the file to look incorrect in others editors that have a different tab size set. It will also cause multi-character operators to be aligned to the first character instead of the character from alignment_chars.
Default: false
alignment_chars
A list of characters to align mid-line when executing on a multi-line selection.
Default: ["="]
alignment_space_chars
The characters from alignment_chars that should have at least once space before them.
Default: ["="]
alignment_prefix_chars
Characters that should be aligned with alignment_chars.
Default: ["+", "-", "&", "|", "<", ">", "!", "~", "%", "/", "*", "."]

It is also possible to change settings on a per-syntax basis. For example, by default Alignment adds the : character to the alignment_chars setting for Javascript and JSON files.

Changelog

v2.0.0

v1.1.3

v1.1.2

v1.1.1

v1.1.0

v1.0.6

v1.0.5

v1.0.4

v1.0.3

v1.0.2

v1.0.1

v1.0.0

License

Sublime Alignment is licensed under the MIT license. Please see the readme.creole file in the package directory for the text of the license.

GitHub

Source

The source code for Sublime Alignment is available on GitHub at https://github.com/wbond/sublime_alignment.