One may come across the table like this:
The general idea is:
Paste enough spaces between the columns, so that the leftmost element from the second column will appear to the right relatively to rightmost element from the first column. In
latex files like in the video/animation,
& symbol serves as a delimiter between the columns, so I use
:%s/&/ &/g to precede all the ampersands with bunch of spaces. How much exactly spaces you need depends on the cell length.
Select empty column in visual block mode via Ctrl + V. To move leftwards everything to the right of the selection, use
<. Repeat the action as many times as you need with
.. The video and the animation show this only for the first time, when second column is being aligned. It is not the shortest way, and it is shown only for better understanding of what’s going on.
Once you’ve selected an empty column, instead of
<....... or so you may do
20<. This method is used to align the remainder of the table in the video/animation.
I started to learn vim about 5 years ago, when someone told me that vim knows how to work with columns. Since then this ability of vim is one of my favorites. I love vim!