u/CRTejaswi

▲ 3 r/vim

Vim9.0: Commenting Inside A Dictionary

How do I safely insert comments inside a dictionary definition?

let s:groups = {
\ '0': {                         " black/white
\   '':  ['#000000', '#ffffff'], " ...
\   '0': ['#000000', '#f5f5f5'], " ...
\   '1': ['#000000', '#dcdcdc'], " ...
\   '2': ['#000000', '#d3d3d3'], " ...
\ },
...
\}
reddit.com
u/CRTejaswi — 1 day ago

Unexpected Behaviour with `args[$_]`

This snippet:

function lf {
    if ($args){
        (0..($args.Count-1) | %{ "$args[$_]" }) -join ','
        (0..($args.Count-1) | %{ "$($args[$_])" }) -join ','
    } else{
        ...
    }
}
lf pdf png txt

prints:

[0],[1],[2]
,,

instead of the expected pdf,png,txt. Why?


I'm concerned with 0..N | args[$_] failing (but args[N] works) even though the syntax pipes well to most objects/cmdlets.

⚠️ RESOLVED, thanks to surfingoldelephant.

reddit.com
u/CRTejaswi — 4 days ago