Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to align at/after last pattern occurence?

Example:

this is my text, this is, this is my text
this, this is my, this is my, this is text
this is, my text, this is, this is my text
this, this is my, this is my, this is text  

Normally, I use Tabular plugin to align text.
P.e. to align at the 1st or 2nd occurence of ','
I use this formule:

Tabularize /^\(.\{-}\zs,\)\{1}/l0
Tabularize /^\(.\{-}\zs,\)\{2}/l0

and to align after the 1st or 2nd occurence of ','

Tabularize /^\(.\{-}\zs,\)\{1}\zs/l0l1
Tabularize /^\(.\{-}\zs,\)\{2}\zs/l0l1

But how do I align *at and after the LAST occurence * of ','
if I don't know how many occurences there are?

like image 458
Reman Avatar asked Dec 06 '25 06:12

Reman


1 Answers

I think in vim the last occurrence of a , would be matched with .*\zs,.

So you should be able to issue a command like Tabularize /.*\zs,/

like image 166
Ro Yo Mi Avatar answered Dec 07 '25 21:12

Ro Yo Mi