randy3k / AlignTab

An alignment plugin for Sublime Text using regular expression

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] Allow a user to provide multiple regex to run sequentially

KroniK907 opened this issue · comments

I will often have some lines which I would like to run two or three AlignTab commands on.

one example would be a set of ternary operators like this:

$variable = empty($var) ? $var2 : $var1;
$var3 = empty($var) ? $var5 : $var4;

In this case I need to run AlignTab 3 times. Once to align on the =, once to align the ? and once to align the :

Sadly this means either I have to have 3 key binds set up, or 3 custom context menus, or run each regex manually. It would be nice if I could run the align_tab command once with a list of regex that get executed sequentially.

I'd create a pull request but i'm pretty busy at the moment. Thanks!

If each line only contains one =, ?, and :, you could use the regexp =|\?|:.

And in fact, this has been requested in #39 .

Just created a pull request #59 that allows user_input to be called as list of regexp as well as a string, then iterate through each regexp in the list. Not sure if this is how you would want it done, but it works

Thanks, it sounds great. I will review it tomorrow and merge it if there are not major issues.

Further Discussion will happen on the pull request. #59