Wednesday, September 7, 2011

HTML syntax & netrw

It seems that something about the netrw plugin is confusing Vim's syntax
highlighting for HTML. For instance, if I edit
http://tmh.cc/vimtest.html with netrw, either by invoking Vim from the
command line as `vim http://tmh.cc/vimtest.html` or doing the same in an
existing Vim instance with `:e`, the filetype is correctly detected as
HTML, and the opening tag of each HTML tag pair is correctly
highlighted, but the closing tag does not seem to be recognized as such
and is not correctly highlighted. This not only affects highlighting,
but also auto-indentation as well; it seems to be a bad interaction
between netrw and the html.vim syntax file.

If I download the file separately and then edit it locally:

wget http://tmh.cc/vimtest.html
vim vimtest.html

then the syntax highlighting is fine. The only difference in the output
of `:scriptnames` between these two test cases is the inclusion of
$VIMRUNTIME/plugin/netrwPlugin.vim in the netrw case, so again, it seems
that netrw is somehow the culprit.

One other thing I tried was to edit the file with netrw and then save it
locally with `:saveas`. After doing this, the syntax problems remained,
but once I exited Vim and reopened the local copy of the file, the
problems went away.

Although I am using a contrived example in this case, the problem seems
to affect any HTML file I edit via netrw. I also tried accessing the
file over SCP rather than HTTP, with the same result.

Is anyone else able to reproduce this behavior, or is it somehow
specific to my Vim configuration? Any suggestions or thoughts on what to
try?

--
You received this message from the "vim_use" 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

No comments: