Loading ...
Sorry, an error occurred while loading the content.

{patch} man.vim syntax file

Expand Messages
  • Craig Barkhouse
    This patch modifies the man.vim syntax file so that the period ( . ) is acceptable in the man page name. Lots of configuration-related man pages, e.g.
    Message 1 of 4 , Feb 1, 2001
    • 0 Attachment
      This patch modifies the man.vim syntax file so that the period (".") is acceptable in the man page name. Lots of configuration-related man pages, e.g. "inetd.conf", use the period.

      16,17c16,17
      < syn match manReference "[a-z][a-z0-9_]*([1-9][a-z]\{0,1})"
      < syn match manTitle "^\i\+([0-9]\+[a-z]\=).*"
      ---
      > syn match manReference "[a-z][a-z0-9_\.]*([1-9][a-z]\=)"
      > syn match manTitle "^[a-z][a-z0-9_\.]*([0-9]\+[a-z]\=).*"


      I'm not sure why the original manReference pattern used only alphanumeric characters plus the underscore, while the manTitle pattern used \i, which is the set of "identifier" characters. I guess the title can be more descriptive than the simple man page name you type on the command line? Anyway, I tried adding the period after the \i as shown below, but for some reason it didn't work. Maybe someone can tell me why. Can't you use \i within square brackets?

      syn match manTitle "^[\i\.]\+([0-9]\+[a-z]\=).*"

      If my removal of \i from manTitle break some man pages, then the syntax file might need further tweaking.
    • Benji Fisher
      ... I am not sure whether there are special rules on this for syntax files, bit in general, character classes like i are not allowed inside [brackets] in
      Message 2 of 4 , Feb 1, 2001
      • 0 Attachment
        Craig Barkhouse wrote:
        >
        > This patch modifies the man.vim syntax file so that the period (".") is acceptable in the man page name. Lots of configuration-related man pages, e.g. "inetd.conf", use the period.
        >
        > 16,17c16,17
        > < syn match manReference "[a-z][a-z0-9_]*([1-9][a-z]\{0,1})"
        > < syn match manTitle "^\i\+([0-9]\+[a-z]\=).*"
        > ---
        > > syn match manReference "[a-z][a-z0-9_\.]*([1-9][a-z]\=)"
        > > syn match manTitle "^[a-z][a-z0-9_\.]*([0-9]\+[a-z]\=).*"
        >
        > I'm not sure why the original manReference pattern used only alphanumeric characters plus the underscore, while the manTitle pattern used \i, which is the set of "identifier" characters. I guess the title can be more descriptive than the simple man page name you type on the command line? Anyway, I tried adding the period after the \i as shown below, but for some reason it didn't work. Maybe someone can tell me why. Can't you use \i within square brackets?
        >
        > syn match manTitle "^[\i\.]\+([0-9]\+[a-z]\=).*"
        >
        > If my removal of \i from manTitle break some man pages, then the syntax file might need further tweaking.

        I am not sure whether there are special rules on this for syntax
        files, bit in general, character classes like '\i' are not allowed inside
        [brackets] in regexp's. See :help /[ for details, and :help alnum and
        following for the kind of character classes that are allowed in brackets.

        HTH --Benji Fisher
      • Bram Moolenaar
        ... This also came up in another message shortly ago. The solution was to use f for the manpage name. I suppose that s right, since the name of the manual
        Message 3 of 4 , Feb 2, 2001
        • 0 Attachment
          Craig Barkhouse wrote:

          > This patch modifies the man.vim syntax file so that the period (".") is
          > acceptable in the man page name. Lots of configuration-related man pages,
          > e.g. "inetd.conf", use the period.
          >
          > 16,17c16,17
          > < syn match manReference "[a-z][a-z0-9_]*([1-9][a-z]\{0,1})"
          > < syn match manTitle "^\i\+([0-9]\+[a-z]\=).*"
          > ---
          > > syn match manReference "[a-z][a-z0-9_\.]*([1-9][a-z]\=)"
          > > syn match manTitle "^[a-z][a-z0-9_\.]*([0-9]\+[a-z]\=).*"

          This also came up in another message shortly ago. The solution was to use
          "\f" for the manpage name. I suppose that's right, since the name of the
          manual page is a file name as well. The required "(1)" after it makes sure it
          doesn't match too often:

          syn match manReference "\f\+([1-9][a-z]\=)"
          syn match manTitle "^\f\+([0-9]\+[a-z]\=).*"

          > Anyway, I tried adding the period after the \i as shown below, but for some
          > reason it didn't work. Maybe someone can tell me why. Can't you use \i
          > within square brackets?
          >
          > syn match manTitle "^[\i\.]\+([0-9]\+[a-z]\=).*"

          Indeed, you can't use \i here. Inside [] the backslash is not a special
          character, except in a few specific cases. This is for Vi compatibility.

          --
          hundred-and-one symptoms of being an internet addict:
          118. You are on a first-name basis with your ISP's staff.

          /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
          ((( Creator of Vim - http://www.vim.org -- ftp://ftp.vim.org/pub/vim )))
          \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
        • Craig Barkhouse
          ... Thanks, this does the job and is much neater to look at. ... Thanks for the tip.
          Message 4 of 4 , Feb 2, 2001
          • 0 Attachment
            Bram wrote:
            > syn match manReference "\f\+([1-9][a-z]\=)"
            > syn match manTitle "^\f\+([0-9]\+[a-z]\=).*"

            Thanks, this does the job and is much neater to look at.

            > > syn match manTitle "^[\i\.]\+([0-9]\+[a-z]\=).*"
            > Indeed, you can't use \i here. Inside [] the backslash is not a special
            > character, except in a few specific cases. This is for Vi compatibility.

            Thanks for the tip.
          Your message has been successfully submitted and would be delivered to recipients shortly.