Sunday, September 17, 2017

Re: Indentation of line continuations in C++ braced initializer lists

On 17.09.17 03:33, Antony Lee wrote:
> However, vim is by default unable to recognize a C++
> braced-initializer list, which effectively have similar semantics as
> parentheses in a function call; it will indent

> // Case 3: oops, 2-space indent, but 4 would be preferred.
> some_type{
> arg1,
> arg2};

...
> In fact it "should" be easy to distinguish Case 1 from Case 3, as Case
> 1 always (AFAICT?) has a closing parenthesis just before the opening
> brace (excluding whitespace) (... and you may also want to check
> whether the word before the previous word is
> struct/class/union/namespace).

If you'd like all that, then it's DIY time, I suspect: :h indentexpr

Existing tweaking within braces is limited: :h cino-e , :h cino-^

As :h C-indenting says: "Vim is not a C compiler: it does not recognize
all syntax"

Admittedly, my vim version is not the very latest.

Erik

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: