sublime_alignment icon indicating copy to clipboard operation
sublime_alignment copied to clipboard

Double inline assignments?

Open f1nnix opened this issue 10 years ago • 4 comments

Hi, thank you for awesome plugin. Is there a way to make sublime_alignment process such assignments

express      = exports.express = require("express");
session      = exports.session = require("express-session");
cookieParser = exports.cookieParser = require("cookie-parser");

to

express      = exports.express      = require("express");
session      = exports.session      = require("express-session");
cookieParser = exports.cookieParser = require("cookie-parser");

Thanks. Any help is appreciated.

f1nnix avatar Feb 12 '15 13:02 f1nnix

Hello, have you found a way to fix this problem? I wonder to know how to do this too! Thanks!

cjhonlyone avatar Jul 21 '20 15:07 cjhonlyone

No, and no need anymore, so no workarounds, sorry.

f1nnix avatar Jul 21 '20 15:07 f1nnix

Using multi-selections you could:

  1. Select all lines
  2. Split selection into lines
  3. Use ctrl+right to jump until the first set of =
  4. Align
  5. Use ctrl+right to jump until the second set of =
  6. Align

It sounds complicated, but once you've done it once or twice it really isn't much.

wbond avatar Jul 21 '20 15:07 wbond

Thanks! My problem is how to align two or more different characters in one line. Like this:

.m_axi_arid(m_axi_arid),
.m_axi_araddr(m_axi_araddr),
.m_axi_arlen(m_axi_arlen),

.m_axi_arid   (m_axi_arid   )    ,
.m_axi_araddr (m_axi_araddr ),
.m_axi_arlen  (m_axi_arlen  )  ,

.m_axi_arid   (m_axi_arid   ),
.m_axi_araddr (m_axi_araddr ),
.m_axi_arlen  (m_axi_arlen  ),

So I changed Alignment.py a little.

line 121

        alignment_pattern = '|'.join([re.escape(ch) for ch in
            alignment_chars])

To

        for alignment_pattern in [re.escape(ch) for ch in alignment_chars] :

Check if all characters in the list have been aligned.

Do you have more wise way?

cjhonlyone avatar Jul 21 '20 16:07 cjhonlyone