Freyskeyd / atom-alignment

Multi-line and multiple selection alignment package for atom
MIT License
46 stars 12 forks source link

atom-alignment package

Atom package

Inspired by sublime text plugin (sublime_alignment)

Usage

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 = b
var 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|= d
var e c|=   f var g = h
var i c=j var k |= l
var a    =b var c = d
var e c           = f var g = h
var i c=j var k   = l

You can even align multiple matches

lets = see = what := happens
a  = a  = b = c : d := e
lets = see = what      := happens
a    = a   = b = c : d := e

License

MIT © Andre Lerche

MIT © Simon Paitrault