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

Re: ilist fails in a xml fails (thinks whole file is a comment)

Expand Messages
  • James Vega
    ... The m: portion of comments makes Vim treat any line with leading whitespace as a comment (at least in any situation where misc1.c:get_leader_len
    Message 1 of 4 , Nov 1, 2010
    • 0 Attachment
      On Mon, Nov 01, 2010 at 04:24:02PM -0700, Anand Hariharan wrote:
      > Take any XML file that has no comments whatsoever. Now do
      >
      > :ilist /RE/
      >
      > where you know for certain that the RE exists. For me, I always get a
      > E389. However, when I do
      >
      > :ilist! /RE/
      >
      > it works fine. I have not made any file type specific changes and I
      > do not think it is version specific. If needed, I can send the same
      > as a follow-up (am running 7.2 in Windows, FWIW). 'comments' is set
      > to the default viz.,
      >
      > comments=s:<!--,m: ,e:-->

      The "m: " portion of 'comments' makes Vim treat any line with leading
      whitespace as a comment (at least in any situation where
      misc1.c:get_leader_len returning non-zero is used as an indication of
      being a comment).

      So, I'm guessing that most (if not all) of the lines which you are
      expecting to show up with :ilist but are only showing up with :ilist!
      are ones that have leading whitespace.

      > Could anyone else confirm this is a bug or is there something weird in
      > my setup?

      This sounds like something that could be improved in Vim.

      --
      James
      GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@...>
    • Ingo Karkat
      ... I had noticed something like that, too. Since Vim 7.2, the ftplugin/html.vim (and dtd.vim, xml.vim) define setlocal comments=s:
      Message 2 of 4 , Nov 2, 2010
      • 0 Attachment
        On 02-Nov-2010 02:11, James Vega wrote:
        > On Mon, Nov 01, 2010 at 04:24:02PM -0700, Anand Hariharan wrote:
        >> Take any XML file that has no comments whatsoever. Now do
        >>
        >> :ilist /RE/
        >>
        >> where you know for certain that the RE exists. For me, I always get a
        >> E389. However, when I do
        >>
        >> :ilist! /RE/
        >>
        >> it works fine. I have not made any file type specific changes and I
        >> do not think it is version specific. If needed, I can send the same
        >> as a follow-up (am running 7.2 in Windows, FWIW). 'comments' is set
        >> to the default viz.,
        >>
        >> comments=s:<!--,m: ,e:-->
        >
        > The "m: " portion of 'comments' makes Vim treat any line with leading
        > whitespace as a comment (at least in any situation where
        > misc1.c:get_leader_len returning non-zero is used as an indication of
        > being a comment).
        >
        > So, I'm guessing that most (if not all) of the lines which you are
        > expecting to show up with :ilist but are only showing up with :ilist!
        > are ones that have leading whitespace.
        >
        >> Could anyone else confirm this is a bug or is there something weird in
        >> my setup?
        >
        > This sounds like something that could be improved in Vim.

        I had noticed something like that, too. Since Vim 7.2, the ftplugin/html.vim
        (and dtd.vim, xml.vim) define
        setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
        Because of that, my HTML files were line-breaking _everywhere_ when inserting
        text. (After column 80; I'm indenting with <Tab>, and have :set tw=80 fo=cq.)

        I reported that issue to the author of the ftplugins, Dan Sharp (again added to
        this mail), but have never received an answer, so I modified the offending
        setting in after/ftplugin and mostly forgot about it.

        I agree with James's analysis that the "middle" part causes problems, because it
        can also stand for a normal indented line, and thus matches in many lines that
        are NOT part of a multi-line comment. Furthermore, I found out that Vim does not
        strictly match 4 spaces, but also accepts a <Tab> for a match. Vim's
        capabilities seem to be too limited for HTML/XML comments. (Using syntax
        highlighting definitions for formatting a la ':setl comments=syntax:htmlComment'
        might be a great feature to have.)

        -- regards, ingo

        --
        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
      • Anand Hariharan
        ... (...) ... (...) ... (...) ... Thanks to James and Ingo for your posts. Just a note to say/confirm that when I stripped off m: portion from the
        Message 3 of 4 , Nov 3, 2010
        • 0 Attachment
          On Nov 2, 2:13 am, Ingo Karkat <sw...@...> wrote:
          > On 02-Nov-2010 02:11, James Vega wrote:
          (...)
          > >> 'comments' is set
          > >> to the default viz.,
          >
          > >> comments=s:<!--,m:     ,e:-->
          >
          > > The "m:    " portion of 'comments' makes Vim treat any line with leading
          > > whitespace as a comment (at least in any situation where
          > > misc1.c:get_leader_len returning non-zero is used as an indication of
          > > being a comment).
          >
          (...)
          > >> Could anyone else confirm this is a bug or is there something weird in
          > >> my setup?
          >
          > > This sounds like something that could be improved in Vim.
          >
          > I had noticed something like that, too. Since Vim 7.2, the ftplugin/html.vim
          > (and dtd.vim, xml.vim) define
          >     setlocal comments=s:<!--,m:\ \ \ \ ,e:-->
          (...)
          > I agree with James's analysis that the "middle" part causes problems, because it
          > can also stand for a normal indented line, and thus matches in many lines that
          > are NOT part of a multi-line comment. Furthermore, I found out that Vim does not
          > strictly match 4 spaces, but also accepts a <Tab> for a match. Vim's
          > capabilities seem to be too limited for HTML/XML comments. (Using syntax
          > highlighting definitions for formatting a la ':setl comments=syntax:htmlComment'
          > might be a great feature to have.)
          >

          Thanks to James and Ingo for your posts. Just a note to say/confirm
          that when I stripped off m:\ \ \ \ portion from the comments setting,
          I can get ilist to work just fine.

          best wishes,
          - Anand

          --
          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
        Your message has been successfully submitted and would be delivered to recipients shortly.