Aligning text with Tabularize
I am using the Tabularize plugin in Vim and have the following text:
reg [321:123] ip_addr=32'h12345678;
reg [15:0] trie_data=16'h9abc;
reg [2:0] select=3'h5;
wire [3:0] nibble;
wire sram_bit;
which I want to align this way:
reg [321:123] ip_addr = 32'h12345678;
reg [15:0] trie_data = 16'h9abc;
reg [2:0] select = 3'h5;
wire [3:0] nibble;
wire sram_bit;
In words:
- left align / wire in the first column
- align bit width, if any, along ':'
- left-align names in the third column
- = characters in 4th column
- left alignment of the seed values in the 5th column.
So far, I've tried the following in order:
:Tabularize /[[0-9]*:/l1r0l0
:Tabularize /:[0-9]*]/l0l1l0
:Tabularize /=
but this concatenates "wire" and "sram_bit" in the first column instead of putting it in the first and third columns respectively.
+3
source to share
2 answers