Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Multi-selection alignment plugin for sublime text

branch: master
readme.creole

Sublime Alignment

A Sublime Text 2 (http://www.sublimetext.com/2) plugin that provides a simple key-binding for aligning multi-line selections and multiple selections.

Installation

Clone or copy this repository to your Packages directory (the folder that is opened when clicking the "Preferences > Browse Packages..." menu entry).

Usage

Press ctrl+shift+a (Windows, Linux) or cmd+shift+a (OS X). The following examples use a | to indicate a cursor. <<< indicates the beginning of a selection and >>> indicates the end of a selection.

If multiple lines are selected within a single selection and the left edges are not indented to the same level, all lines will be shifted to have a consistent indent level. The indentation will follow the current indentation preferences, either spaces or tabs.

Before:

<<<
var foo = 1;
  var bazz = foo;
	var qu = foo + bazz;
>>>

After:

<<<
	var foo = 1;
	var bazz = foo;
	var qu = foo + bar;
>>>

If multiple lines are selected with a single selection and all selected lines have the same indent level, the first equal sign on each line will all be aligned to the same column, using spaces.

Before:

<<<
	var foo = 1;
	var bazz = foo;
	var qu = foo + bar;
>>>

After:

<<<
	var foo  = 1;
	var bazz = foo;
	var qu   = foo + bar;
>>>

If multiple selections exist, spaces will be inserted to cause all selections to be aligned to the same column.

Before:

array(
	'foo'| => 1,
	'bazz'| => 2,
	'qu'| => 3
)

After:

array(
	'foo' | => 1,
	'bazz'| => 2,
	'qu'  | => 3
)

License

All of Sublime Alignment is licensed under the MIT license.

Copyright (c) 2011 Will Bond <will@wbond.net>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.