Align at longest word

vim

Solution

Without plugin:

:%s/=/                      &/
:%s/\%13c\s\+=/=

First command will insert spaces before first equal signs on all lines, second one will remove all spaces before an equal sign at 13th column. You could also use Visual block selection and `<.....` to shift left as many times as necessary.

However this is really unclean. With the tabular plugin you just type `:Tab /=/` and this will do the work and the range will be calculated automatically (greatest range around the cursor in which all lines match the pattern).

Problem

I have the following code: ``` a = 123 p.value 0.123 p.long.name = "abc" ``` How can I align each line like shown below in vim? ``` a = 123 p.value = 0.123 p.long.name = "abc" ``` Thanks for any hints.

Original source