Align to Nearest Tabstop
I opened godlygeek/tabular#38 before discovering this project, but I think the same issue applies. Any thoughts?
I would like to second this. vim-easy-align is a great plugin, but it does not seem to allow aligning at a multiple of the tab stop, it only aligns naively to the right-most delimiter, after shrinking its preceding inter-word text to a single space. This does not look very good, the text has a bottleneck and doesn't align on tabular columns but at whatever random offset happens to be present depending on the length of the longest identifier. There is no "stretch" space to handle future additions that might be longer (and it will cause adding one single variable with a longer name to make the patch change all surrounding lines every time, for example).
It shouldn't just use "nearest" btw, it should allow some way to specify how many stops out. One way might be to preserve the spacing that precedes the delimiter of the chosen referent line, instead of collapsing it to one space. At least this allows a manual workaround (to manually place the delimiter of the longest identifier at the desired column) that won't get eaten by the alignment operation. Just don't move the delimiter to the left, leave it where it is (and as before, move the delimiters at lesser offsets to the right to align them)
this = that
foo = bar
this_is_a_test = baz
could become:
this = that
foo = bar
this_is_a_test = baz
where today it is always:
this = that
foo = bar
this_is_a_test = baz
if we could add an ordinal somehow to say "space out this many tab stops" that would be even better but allowing manual placement of the furthest-offset one would provide a workaround...
(@orbisvicis I think maybe the issue should be re-described here in your first comment, instead of just referring to another project. The text of the linked issue doesn't really make sense anyways for this plugin because it uses a totally different syntax.)
Thanks for the suggestion. But I don't think I'll have time for this at the moment. And this plugin is already quite complex with many number of options, adding another one while making sure that it's compatible with the pre-existing ones is not going to be trivial. FYI, easy-align sees the snippet in the following way
<----token---><left-margin><delimiter><right-margin>
this__________.............===========..............that
foo___________.............===========..............bar
this_is_a_test.............===========..............baz
Note that the length of delimiter is variable and we also need to consider how it should behave when stick_to_left (or <) is set.
In case you guys are still interested. I hacked this plugin to tab align after the delimiter.
https://github.com/jeffreydwalter/vim-easy-align/commit/5b4bcc38c3ec73e0ccee85f42fa3ef97bc8b7651
This solution is by no means correct or complete, but it will align stuff after the delimiter on tab boundaries, based on the current tabstop setting.
Currently, this behavior is on all the time, and has no real integration with any of the other formatting options that deal with spacing between the delimiter and right-hand side tokens.
If this looks like it's headed in the right direction, I'd appreciate any help or feedback about how to take this feature the rest of the way.
So, something like
foo: bar
a: baz
basdadads: pizza
becomes
foo: bar
a: baz
basdadads: pizza