The default alignment in vim (using "=") aligns my code as:
void my_loooong_function (int arg1,
int arg2,
int arg3
)
However, I wish to align with all arguments starting at same line, as:
void my_loooong_function (int arg1,
int arg2,
int arg3
)
How can this be done?
To make ==
work as you wish, you need to set cinoptions
appropriately:
:set cino+=(0
Full documentation of the possible values can be found via :help cinoptions-values
, and in particular :help cino-(
to control the indentation inside unclosed parentheses.
The setting will also affect the autoindent behaviour (for example, when you enter a carriage return after opening a bracket).
This can, of course, be added to your vimrc or an ftplugin to automatically set this value for certain filetypes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With