preservim / nerdcommenter

Vim plugin for intensely nerdy commenting powers
Creative Commons Zero v1.0 Universal
5k stars 447 forks source link

Add delimiter for pamenv #530

Closed huangyxi closed 11 months ago

huangyxi commented 11 months ago

The "#" character at start of line (no space at front) can be used to mark this line as a comment line. https://man7.org/linux/man-pages/man5/pam_env.conf.5.html

alerque commented 11 months ago

This will only partially work because I don't think we have any accommodations for forcing comments to be at the start of a line. That might be worth opening a feature request to track as it may affect other formats as well. I can merge this but results will be a little bit inconsistent since most of the macros assume comments can start anywhere in a line.

huangyxi commented 11 months ago

Thank you for your response and for identifying a generic issue in commenting.

I agree with the point that the current modification may not strictly follow the official document, potentially leading to inconsistency. However, in this specific situation, commenting whether at the start of a line doesn't actually affect the final result. Since the initial release of Linux-PAM on GitHub in June 2000, leading white spaces have been skipped before the comment sign # detection. And I have confirmed this on an Ubuntu machine.

    // `/modules/pam_env/pam_env.c`

    /* skip leading white space */
    key += strspn(key, " \n\t");

    /* skip blanks lines and comments */
    if (!key || key[0] == '#')
        continue;

initial commit of above lines in linux-pam current commit of above lines in linux-pam

Anyway, I understand and respect the decision, whether it involves merging this pull request or not.