On Sun, Aug 19, 2018 at 6:37 PM, Bram Moolenaar <[email protected]> wrote:
>
> Currently, when making a list with continuation lines, it is not
> possible to add a comment somewhere:
>
>         let array = [
>                 \ item,
>                 \ item,
>                 \ item,
>                 \]
>
> Adding a comment after the comma causes all the rest to be included in
> the comment:
>
>         let array = [
>                 \ item,
>                 \ item, " comment
>                 \ item,
>                 \]
>
> Since this is equivalent to:
>
>         let array = [ item, item, " comment  item, ]
>
> Simple solutions will such as using \" fail, because just about anything
> following the backslash is valid if we are inside a string:
>
>         echo "some
>                 \ word
>                 \" comment
>                 \ word
>
> Is equivalent to the valid command:
>
>         echo "some word" comment word
>
> So, a line starting with a backslash can't be used for a comment.
> Thinking about what would work (that is, currently it is an error), I
> thought of using |\":
>
>         let array = [
>                 \ item,
>                 |\" comment
>                 \ item,
>                 \]
>
> It looks a bit weird, but it would work.  Any thoughts?
>
> --
> Mynd you, m00se bites Kan be pretty nasti ...
>                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
>
>  /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
> ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\  an exciting new programming language -- http://www.Zimbu.org        ///
>  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

In the case of a List, you can construct it by concatenation, though
it might be a little slower at run-time, depending on how densely you
want to comment:

let array = [
    \ "one",
    \ "two",
    \ ] " three is intentionally omitted
call extend(array, [
    \ "four",
    \ "five",
    \ "six",
    \ ])

Similarly I suppose for other arithmetic operations: hold the
temporary results in one or more variables, insert the comment after
temporarily ending the computation, and go on from there.

Best regards,
Tony.

-- 
-- 
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui