Search code examples
regexvimtabular

Tabular.vim: Align words before delimiter


I want to go from

some.procedure(argOne => var1,
    arg2 => var2,
   argThree => var3)

to

some.procedure(argOne   => var1,
               arg2     => var2,
               argThree => var3)

I tried to run :Tabularize /=>/l1c1l0, but it won't align the arguments to the left.


Solution

  • You need to align both the word before the hash rocket and the hash rocket:

    :Tabularize/\(\w\+\ze\s\+=>\|=>\)/l0l1