Mayur Anvekar
Mayur Anvekar

Reputation: 23

Vim Tabularize multiple lines

How do i use Vim Tabularize to align the following text

text1 text2 temp_line0, text1 text2 temp_line1, text1 text2 [1:0] temp_line2, text1 text2 [15:0] temp_line5, text1 text2 temp_line6, text1 text2 [1:0] temp_line7, text1 text2 temp_line8, text1 text2 [23:0]temp_line9

To something like this ..

text1 text2 temp_line0, text1 text2 temp_line1, text1 text2 [1:0] temp_line2, text1 text2 [15:0] temp_line5, text1 text2 temp_line6, text1 text2 [1:0] temp_line7, text1 text2 temp_line8, text1 text2 [23:0] temp_line9

basically i want to align everything after the "]" in the lines

Upvotes: 0

Views: 406

Answers (2)

Alan Gómez
Alan Gómez

Reputation: 378

A solution can be:

:%s/\(\%>8c\s\|^.*]\)/\1 /

followed by: :%s/\%>25c\s\+//

Upvotes: 0

maggick
maggick

Reputation: 1422

You can use the plugin Tabular available on github :https://github.com/godlygeek/tabular

Nevertheless your text does not have a real separator in each of your line so it will fail.

Upvotes: 3

Related Questions