π 2015-Apr-08 ⬩ βοΈ Ashwin Nanjappa ⬩ π·οΈ easy align, plugin, tabular, vim ⬩ π Archive
Easy Align is a plugin for Vim that makes it super easy to align your code along certain whitespace or characters. Unlike the Tabular plugin, Easy Align is actually easy to use, not requiring you to create and recall esoteric-looking arguments.
Below are a few examples of how I typically use this plugin. For everything below, first visually mark out the lines, press :
followed by command given below:
To align text based on space characters as delimiter:
Align on first delimiter: EasyAlign \
Align on second delimiter: EasyAlign 2\
Align on last delimiter: EasyAlign -\
Align on last 2 delimiters: EasyAlign -2\
Align on all delimiters: EasyAlign *\
To align based on equals character as delimiter. For example, a block of assignment statements in C++. I visually block it and use the command: EasyAlign=
To align based on comma character as delimiter. For example, a block of function calls in C++ along their multiple comma characters: EasyAlign*,
To align a block of function parameters, one on each line: EasyAlign-\
The logic behind these commands is straightforward and is explained in the table of examples on the pluginβs Github page.
Tried with: Vim 7.4 and Ubuntu 14.04