Vim slow opening html files

232 views
Skip to first unread message

Mr.SpOOn

unread,
Apr 8, 2009, 5:54:26 AM4/8/09
to vim...@googlegroups.com
Hi,
I noticed that when I open an html file with file it takes a lot of time.
I mean, also if I just create an empty index.html file.

For "a lot of time" I mean about 10 seconds. What happens is that it
opens Vim with this written in the bottom line:

"index.html" [New File]

Then, after about 10 seconds appears the cursor, the column with row
numbers and the status line.
If I do the same operation with other file types (python, c, etc.) it
is and istantaneous operation.

I thought it could depend on the HTML filetype plugin, but I try to
remove it and nothing changed.
Any suggestion?

Thanks.

Matt Wozniski

unread,
Apr 8, 2009, 4:41:49 PM4/8/09
to vim...@googlegroups.com

Compare

vim test.html -c 'scriptnames'

with

vim test -c 'scriptnames'

and to get a list of different scripts being loaded, and then try to
figure out which of the ones that's only being loaded for html files
is causing problems. With the information you've given, that's the
best suggestion I can make.

~Matt

Mr.SpOOn

unread,
Apr 8, 2009, 5:19:33 PM4/8/09
to vim...@googlegroups.com
2009/4/8 Matt Wozniski <m...@drexel.edu>:

> Compare
>
> vim test.html -c 'scriptnames'
>
> with
>
> vim test -c 'scriptnames'

Thanks. The problem was the HTML syntax file that I had in
/usr/local/share/vim...

Removing it solves the problem.
Anyway, is it normal that it causes this big delay?

Matt Wozniski

unread,
Apr 8, 2009, 5:25:16 PM4/8/09
to vim...@googlegroups.com
2009/4/8 Mr.SpOOn wrote:
>
> Thanks. The problem was the HTML syntax file that I had in
> /usr/local/share/vim...
>
> Removing it solves the problem.
> Anyway, is it normal that it causes this big delay?

Is it normal that syntax highlighting an empty file takes 10 seconds?
Of course not!

~Matt

Mr.SpOOn

unread,
Apr 8, 2009, 6:34:23 PM4/8/09
to vim...@googlegroups.com
2009/4/8 Matt Wozniski <m...@drexel.edu>:

> Is it normal that syntax highlighting an empty file takes 10 seconds?
> Of course not!

Yes, right. Of course not. I asked a silly question, and I got a silly answer.

Any idea about what can possibly be the cause of the delay?

John Beckett

unread,
Apr 8, 2009, 6:49:08 PM4/8/09
to vim...@googlegroups.com
Mr.SpOOn wrote:
> Any idea about what can possibly be the cause of the delay?

Give us some help! What is this file? Is it distributed with Vim?
Is there any origin or version or date info in the first few lines
of the file?

Often, 10-second delays are due to something attempting to access
data over a network.

John

Mr.SpOOn

unread,
Apr 8, 2009, 7:48:40 PM4/8/09
to vim...@googlegroups.com
2009/4/9 John Beckett <johnb....@gmail.com>:

> Give us some help! What is this file? Is it distributed with Vim?
> Is there any origin or version or date info in the first few lines
> of the file?

Yes, well, on the html.vim syntax file there is this:

" Vim syntax file
" Language: HTML
" Maintainer: Claudio Fleiner <cla...@fleiner.com>
" URL: http://www.fleiner.com/vim/syntax/html.vim
" Last Change: 2006 Jun 19


I'm using a compiled version of Vim 7.2.

> Often, 10-second delays are due to something attempting to access
> data over a network.

I often work on remote files via netrw, but it is pretty fast. I mean,
since I renamed that html syntax file I can open every file (php,
html, css) on the server in just a second.

Anyway, without that syntax file I get this error:

E108: No such variable: "b:current_syntax"

John Beckett

unread,
Apr 8, 2009, 10:24:31 PM4/8/09
to vim...@googlegroups.com
Mr.SpOOn wrote:
> I often work on remote files via netrw, but it is pretty
> fast. I mean, since I renamed that html syntax file I can
> open every file (php, html, css) on the server in just a
> second.

Weird suggestion: Close Vim. Rename plugin/matchparen.vim to
matchparen.txt or whatever (or move it somewhere). Do you still
have the slowness problem?

I forget the issue at the moment, but there was a report about
that plugin using some system call that doesn't work well in
some cases (particularly over a network).

John

Tony Mechelynck

unread,
Apr 8, 2009, 11:12:05 PM4/8/09
to vim...@googlegroups.com

You should NEVER modify or remove ANY files in $VIMRUNTIME or its
subdirectories, because any upgrade of the runtime files may (and sooner
or later one will) overwrite any changes that you apply there, with no
warning that something untoward happened.

That means (on Linux with Vim 7.2) /usr/local/share/vim/vim72/ and
anything below it.

However, there may be another way to disable plugins in that directory
tree. Read further.

One reason why the HTML syntax script may be slower than some others is
that HTML syntax invokes several other syntax scripts, namely CSS,
javascript and vbscript. However, 10 seconds is clearly a lot (and it
loads faster than that on my system). Maybe disabling just one oor a few
of them would improve performance (though that's far from certain). For
instance, if you never use vbscript in your HTML pages (or elsewhere)
you might disable that.

And now here's how to disable a syntax script:
In ~/.vim/syntax/ (which you may create if it doesn't exist), add a
script of the same name as the script you want to disable, but
containing only the following line:

let b:current_syntax = expand("<sfile>:t:r")

That's all. It should make the script of the same name in
$VIMRUNTIME/syntax finish early when it notices that b:current_syntax is
already set. (:scriptnames will still mention it, but it won't have done
anything.)


Best regards,
Tony.
--
Eye have a spelling checker, it came with my PC;
It plainly marks four my revue mistakes I cannot sea.
I've run this poem threw it, I'm sure your please to no,
It's letter perfect in it's weigh, my checker tolled me sew!

baz.de...@gmail.com

unread,
Apr 9, 2009, 3:48:36 AM4/9/09
to vim_use
I've got the same problem earlier , i thought that was html syntax
file or php syntax but that was patchparen.vim , it realy sucks , I
have remove it forever and have no such problems anymore.

On Apr 9, 6:12 am, Tony Mechelynck <antoine.mechely...@gmail.com>
wrote:

Mr.SpOOn

unread,
Apr 9, 2009, 5:44:00 AM4/9/09
to vim...@googlegroups.com
John Beckett:

> Weird suggestion: Close Vim. Rename plugin/matchparen.vim to
> matchparen.txt or whatever (or move it somewhere). Do you still
> have the slowness problem?

I tried renaming the matchparen plugin, but it is still slow.

Tony Mechelynck:


> For instance, if you never use vbscript in your HTML pages (or elsewhere)
> you might disable that.

I've tried a couple of things.
I didn't need vbscript syntax, so I did what you said, but nothing.

I tried to do the same with the html.vim syntax file and this solved
the slowness problem for html local files. Anyway, when I try to edit
a file on the server, using netrw, it is still very slow. To solve
this I need to rename the html.vim syntax file in $VIMRUNTIME, but I
don't have to do this.

I'm confused :\

John Beckett

unread,
Apr 9, 2009, 7:21:45 AM4/9/09
to vim...@googlegroups.com
Mr.SpOOn wrote:
> I tried renaming the matchparen plugin, but it is still slow.

I'm sorry to be a pain, but the message from baz in this thread
is suggesting a confirmation of my wild recollection.

It might be worth renaming matchparen.vim again, then starting
Vim and using :scriptnames and carefully checking that
matchparen really is not in the list.

John

Mr.SpOOn

unread,
Apr 9, 2009, 7:43:40 AM4/9/09
to vim...@googlegroups.com
2009/4/9 John Beckett <johnb....@gmail.com>:

> I'm sorry to be a pain, but the message from baz in this thread
> is suggesting a confirmation of my wild recollection.

It's ok :D

> It might be worth renaming matchparen.vim again, then starting
> Vim and using :scriptnames and carefully checking that
> matchparen really is not in the list.

I'm sure. It is not in the list.

Reply all
Reply to author
Forward
0 new messages