📅 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:
Align on second delimiter:
Align on last delimiter:
Align on last 2 delimiters:
Align on all delimiters:
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:
To align based on comma character as delimiter. For example, a block of function calls in C++ along their multiple comma characters:
To align a block of function parameters, one on each line:
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