Reputation: 93
I want vim to auto indent like this
int function_that_takes_long_arguments(long_argument_1,|
^
This is the cursor.
Press enter
int function_that_takes_long_arguments(long_argument_1,<enter>
> > > > > > > > > ...|);
^ ^ ^
(tab - 4 spaces) | |
(Add spaces to align) |
(I want the cursor to auto indent here)
Start writing other arguments
int function_that_takes_long_arguments(long_argument_1,<enter>
> > > > > > > > > ...long_argument_2,<enter>
> > > > > > > > > ...long_argument_3);
Another Example:
void function(argument_1, argument_2, argument_3,<enter>
> > > ..argument_4, argument_5);
Upvotes: 2
Views: 253
Reputation: 15091
Indenting in C/C++ files is typically managed by internal routine (see also :h C-indenting
). The supported options are explained in detail under :h cinoptions-values
.
So assuming you have setlocal cindent
in the current buffer (including simply filetype indent on
which sets cindent
for a few filetypes/extensions automatically), it's enough to do usual
~.vim/after/indent/c.vim
setlocal cinoptions=(0
Upvotes: 2