- align
- alignment
- pulsar
- regular
- expression
- regex
- regexp
- emacs
- selection
-
Made for Pulsar!
This package was written specifically for Pulsar and did not exist in the Atom package repository.
align-regexp Pulsar package
This package is more or less the equivalent of Emacs align-regexp command for Pulsar.
Continuation and fork of https://github.com/danhper/atom-align-regexp, I am working on this version of it because I love the package but it has not been updated in almost a decade, and has some very obvious bugs, which I hope to fix.
Since this is my (Anna's) fork of it, I will modify it to work how I want it to, but the goal is to maintain the simplicity, whatever you could do in the previous version I aim to maintain in this version

Installation
Install the align-regexp package using pulsar package manager, if you use the CLI:
ppm install pulsar-align-regexp
Usage
-
Select something
-
Type
ctrl+alt+a, or whatever keybinding you assigned. The command name isalign-regexp:align-selection. -
Enter a regexp in the mini-editor and press enter. It will often be a single char, like
=or:, but can also be for examplefromto align ES6 imports.NOTE: the string is evaluated as a regexp, so characters like
|or.must be escaped
Advanced usage
You can use regexp flags with the following syntax:
FLAGS: REGEXP, for example: g: \|.
When the g flag is passed all occurences of the regexp will be aligned times,
which can be handy for tables. For example, with the above expression,
foo | bar | baz
foobar | barbaz | bazqux
will become
foo | bar | baz
foobar | barbaz | bazqux
Known limitations
-
This package does not handle full-width chars, such as Japanese or Chinese. If someone wants to send a PR to support it, I will be glad to merge it.
-
The regexp match is always preceded by a space when aligning, this works for most cases, but can be undesirable, for example for table headers
Comparison to alternatives
There are a lot of packages for this task, most of them try to be smart. This ones tries to be stupid, so you have to enter explicitly on which regexp you want to align. I was using atom-alignment before creating this package. Pick the one that fits your needs the best.