Monday, August 17, 2015

Re: C comment block indentation woes

On 17.08.15 07:26, LCD 47 wrote:
> On a side note: you can usually avoid dealing with ":set" for
> options that take string values by using "let &option = ..." instead of
> "set option=...". E.g. for the line above:
>
> let &comments = 'sO:* -,mO:* ,exO:*/,s1:/*,mb:*,ex:*/,://'

Thanks for that, lcd. Trying my 90% fix of the indenting issue with that
&comments as a base, we can have:

/*
| As Vim requires a non-space in order to recognise
| comment middle lines, then
| it boils down to an aesthetic choice.
*/

/*
; Vim-style middle line
; prefix, perhaps?
*/

The latter with:

let &comments = 'sO:* -,mO:* ,exO:*/,s:/*,mb1:;,ex-1:*/,://'

The "let" syntax does allow entering "mb1: ,", and the comment middle
lines then have no visible prefix, but the auto-conversion of the last
prefix to "*/" on a single '/' keystroke, to finish the comment, then
fails.

Trying for a NBSP, to see if that's sufficiently distinctive, without
being visible, with:

let &comments = 'sO:* -,mO:* ,exO:*/,s:/*,mb1:%xA0,ex-1:*/,://'

Delivers the literal "%xA0" as middle line prefix. Is there a way to put
an NBSP into &comments, I wonder?

My alibi for the formatting police would be:

"The comments conform to the coding standard. The leading ';' are
comment content, and therefore not precluded by policy."

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:

Post a Comment