Inspired by sublime text plugin (sublime_alignment)
A simple key-binding for aligning multi-line, multi-cursor and multiple selections in Atom.
Use ctrl+cmd+a
on Mac or ctrl+alt+a
to align multiple matches. If you want to align the first match only, call Atom Alignment:Align
from the command palette. The following examples all use the mentioned key binding to call Atom Alignment:AlignMultiple
.
var a = b;var ab = c;var abcd = d;var ddddd =d;
var a = b;var ab = c;var abcd = d;var ddddd = d;
With more than one selection
var a = b; /* selection 1 */var ab = c; /* selection 1 */var notMePlease='NOOOO';var abcd = d; /* selection 2 */var ddddd =d; /* selection 2 */
var a = b;var ab = c;var notMePlease='NOOOO';var abcd = d;var ddddd = d;
On a single line started with ctrl+cmd+a
var a = b var cde = d
var a = bvar cde = d
When working with multiple cursors, the different lines are aligned at the best matching cursor position. In the following example the | shows the cursor position.
var a =b var c|= dvar e c|= f var g = hvar i c=j var k |= l
var a =b var c = dvar e c = f var g = hvar i c=j var k = l
You can even align multiple matches
lets = see = what := happensa = a = b = c : d := e
lets = see = what := happensa = a = b = c : d := e
MIT © Andre Lerche
MIT © Simon Paitrault
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.