Kurt Keller's Blog

tech notes and more

align lines

Usually lines are left aligned when writing in languages which use the alphabet. For certain formatting, however, it may be beneficial to right align or center some lines.

Easily done. Use ri to right align the current line, le to left align it and ce to center it.

All three commands accept a range in front of them. So the command
:.,+4 ri
will right align (ri) the current (.) and next four (+4) lines.

After le an optional indent can be specified.
After both ri and ce an optional line width to use for the calculation can be specified.

:ri right align the line(s)
:le left align the line(s)
:ce center the line(s)
Share

Leave a Reply