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

16 views
Skip to first unread message

Anand Hariharan

unread,
Nov 1, 2010, 7:24:02 PM11/1/10
to vim_dev
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:-->

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

- Anand

James Vega

unread,
Nov 1, 2010, 9:11:35 PM11/1/10
to vim...@googlegroups.com
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 <jame...@jamessan.com>

signature.asc

Ingo Karkat

unread,
Nov 2, 2010, 3:13:47 AM11/2/10
to vim...@googlegroups.com, dws...@users.sourceforge.net

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

Anand Hariharan

unread,
Nov 3, 2010, 6:03:40 PM11/3/10
to vim_dev

On Nov 2, 2:13 am, Ingo Karkat <sw...@ingo-karkat.de> 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

Reply all
Reply to author
Forward
0 new messages