Notepad++ - Aligning text vertically in multiple columns
notepad++
Solution
From `Code alignment` v3 it's possible with the help of regular expressions.
First you have to align the first equal as you already did, with the ordinary way `Plugins` > `Code alignment` > `Align by equals`.
Then, go to `Plugins` > `Code alignment` > `Align by...` (or hit Ctrl + Shift + =) and write the following expression:
.+(?<x>=)
Don't forget to check the "Use regular expressions" option. This expression will align only the last equal, instead of the first.
These two steps will return the desired result:
class Constants(object):
VAL_CONST = 5 # Lorem ipsum dolor sit amet = 213
TEST_CONST = 0.2324 # Curabitur condimentum elementum = 32
PARALLEL_CONST = 88 # Vivamus vehicula, mauris nec vehicula pulvinar, urna nibh mollis = 1342
CURVE_SPATIAL_CONST = 0.000005892 # Donec sagittis in lacus = 0.55
Problem
I'm trying to align some lines in my code that has comments that could use with some alignment too. I used the notepad++ "Code-Alignment" plugin, and aligned the text below. ``` class Constants(object): VAL_CONST = 5 # Lorem ipsum dolor sit amet = 213 TEST_CONST = 0.2324 # Curabitur condimentum elementum = 32 PARALLEL_CONST = 88 # Vivamus vehicula, mauris nec vehicula pulvinar, urna nibh mollis = 1342 CURVE_SPATIAL_CONST = 0.000005892 # Donec sagittis in lacus = 0.55 ``` I end up with the following: ``` class Constants(object): VAL_CONST = 5 # Lorem ipsum dolor sit amet = 213 TEST_CONST = 0.2324 # Curabitur condimentum elementum= 32 PARALLEL_CONST = 88 # Vivamus vehicula, mauris nec vehicula pulvinar, urna nibh mollis = 1342 CURVE_SPATIAL_CONST = 0.000005892 # Donec sagittis in lacus %$ 0.55 ``` However, I'd like to take this a step further. I'd like to "re-align" the code one more time, this time on the second set of "equals" signs. Preferably without going through the comments to change the second set of equals signs to be more unique. End result of what I'd like: ``` class Constants(object): VAL_CONST = 5 # Lorem ipsum dolor sit amet = 213 TEST_CONST = 0.2324 # Curabitur condimentum elementum = 32 PARALLEL_CONST = 88 # Vivamus vehicula, mauris nec vehicula pulvinar, urna nibh mollis = 1342 CURVE_SPATIAL_CONST = 0.000005892 # Donec sagittis in lacus = 0.55 ```