Maybe the tabular plugin suits your needs?
E.g:
class Test
attr_accessor :a, :b, :c,
:d, :e, :f
end
typing :Tabularize /:\a\S\s/l0
will result in
class Test
attr_accessor:a, :b, :c,
:d, :e, :f
end
:Tabularize /:
aligns all colons. The colon must be followed by a letter (\a
), a non whitespace character (\S
) and a whitespace (\s
). That complete match is then left-adjusted (/l0
). The zero afterwards prevents Tabular to add whitespace after each alignment.
note that this is not permanent. I.e. when you reformat your code, the aligning is destroyed and it will look like the first example again. To make this aligning persistent, you could maybe define a custom formatting function which runs the above tabular command after the vim formatting. But I don't know much about that.