how to replace very slow html/css syntax plugin

18 views
Skip to first unread message

Fetchinson

unread,
Sep 2, 2021, 9:53:31 AM9/2/21
to vim...@googlegroups.com
Hi all,

I opened this issue on the issue tracker,

https://github.com/vim/vim/issues/8825

which was eventually closed because the problem is not about vim but
rather a plugin.

The default synax plugin that gets shipped in fedora for html/css is
very slow (see profiling information on the tracker, basically
rgb2xterm gets called a lot of times) and I'd like to replace these by
something better. But I'd like to keep the current behaviour for all
other types of files because they seem fine.

Can you recommend a good syntax highlight plugin for html/css? And if
I use those from my .vim directory how do I forbid loading the stock
ones in /usr/share/vim/vim82/syntax ?

Thanks a lot,
Daniel


--
Psss, psss, put it down! - http://www.cafepress.com/putitdown

Yegappan Lakshmanan

unread,
Sep 2, 2021, 9:59:54 AM9/2/21
to vim_use
Hello,

On Thu, Sep 2, 2021 at 6:53 AM 'Fetchinson' via vim_use
<vim...@googlegroups.com> wrote:
>
> Hi all,
>
> I opened this issue on the issue tracker,
>
> https://github.com/vim/vim/issues/8825
>
> which was eventually closed because the problem is not about vim but
> rather a plugin.
>
> The default synax plugin that gets shipped in fedora for html/css is
> very slow (see profiling information on the tracker, basically
> rgb2xterm gets called a lot of times) and I'd like to replace these by
> something better. But I'd like to keep the current behaviour for all
> other types of files because they seem fine.
>
> Can you recommend a good syntax highlight plugin for html/css? And if
> I use those from my .vim directory how do I forbid loading the stock
> ones in /usr/share/vim/vim82/syntax ?
>

If you place the new syntax file under the ~/.vim/syntax directory,
then it will override the syntax file shipped with Vim. This is
explained under ":help mysyntaxfile-replace".

For example, to disable the syntax highligting only for the html
files, you can create a html.vim file under ~/.vim/syntax directory
with only the following line:

let b:current_syntax = "html"

- Yegappan

Christian Brabandt

unread,
Sep 2, 2021, 10:44:53 AM9/2/21
to vim...@googlegroups.com

On Do, 02 Sep 2021, 'Fetchinson' via vim_use wrote:

> Hi all,
>
> I opened this issue on the issue tracker,
>
> https://github.com/vim/vim/issues/8825
>
> which was eventually closed because the problem is not about vim but
> rather a plugin.
>
> The default synax plugin that gets shipped in fedora for html/css is
> very slow (see profiling information on the tracker, basically
> rgb2xterm gets called a lot of times) and I'd like to replace these by
> something better. But I'd like to keep the current behaviour for all
> other types of files because they seem fine.
>
> Can you recommend a good syntax highlight plugin for html/css? And if
> I use those from my .vim directory how do I forbid loading the stock
> ones in /usr/share/vim/vim82/syntax ?

Does fedora really ship
https://github.com/skammer/vim-css-color/blob/master/after/syntax/css.vim
as default css syntax plugin? Or is this not rather an additional
plugin, that you can uninstall?

Note, the default Vim syntax runtime plugin is this one
https://github.com/vim/vim/blob/master/runtime/syntax/css.vim And my
guess is, that fedora does install this one. But if in doubt, you should
be able to simply drop that one into ~/.vim/syntax/ and it should work.

Best,
Christian
--
Zerstreuete Gedanken lieset man wieder zerstreuet und blättert in
ihnen herum.
-- Jean Paul

Eike Rathke

unread,
Sep 2, 2021, 4:50:37 PM9/2/21
to vim...@googlegroups.com
Hi,

On Thursday, 2021-09-02 16:44:45 +0200, Christian Brabandt wrote:

> Does fedora really ship
> https://github.com/skammer/vim-css-color/blob/master/after/syntax/css.vim
> as default css syntax plugin?

No, the default is the https://github.com/jsit/css.vim one that
redirects to https://github.com/vim-language-dept/css-syntax.vim and is
the same as
https://github.com/vim/vim/blob/master/runtime/syntax/css.vim you
mentioned.

There's an additional package vim-syntastic-css of
https://github.com/vim-syntastic/syntastic that "runs files through
external syntax checkers and displays any resulting errors", maybe
that's installed and could explain some slowness.

The skammer plugin was mentioned by the OP only because they just
happened to have come across it on the net (citing from
https://github.com/vim/vim/issues/8825 "As I was searching around found
this with more or less the same problem").

Eike

--
OpenPGP/GnuPG encrypted mail preferred in all private communication.
GPG key 0x6A6CD5B765632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Use LibreOffice! https://www.libreoffice.org/
signature.asc

Christian Brabandt

unread,
Sep 3, 2021, 3:19:29 AM9/3/21
to vim...@googlegroups.com

On Do, 02 Sep 2021, Eike Rathke wrote:

> Hi,
>
> On Thursday, 2021-09-02 16:44:45 +0200, Christian Brabandt wrote:
>
> > Does fedora really ship
> > https://github.com/skammer/vim-css-color/blob/master/after/syntax/css.vim
> > as default css syntax plugin?
>
> No, the default is the https://github.com/jsit/css.vim one that
> redirects to https://github.com/vim-language-dept/css-syntax.vim and is
> the same as
> https://github.com/vim/vim/blob/master/runtime/syntax/css.vim you
> mentioned.
>
> There's an additional package vim-syntastic-css of
> https://github.com/vim-syntastic/syntastic that "runs files through
> external syntax checkers and displays any resulting errors", maybe
> that's installed and could explain some slowness.
>
> The skammer plugin was mentioned by the OP only because they just
> happened to have come across it on the net (citing from
> https://github.com/vim/vim/issues/8825 "As I was searching around found
> this with more or less the same problem").

Ah okay, makes sense. However, looking at the profile from
https://github.com/vim/vim/issues/8825

FUNCTIONS SORTED ON SELF TIME
count total (s) self (s) function
294 1.590729 0.847627 67_Rgb2xterm()
224910 0.743102 67_pow()
2599 0.032777 67_PreviewCSSColorInLine()
147 1.598205 0.005605 67_SetNamedColor()
255 0.004275 67_Xterm2rgb()
147 0.001871 67_FGforBG()
3 0.000565 60_AddITags()
2 0.000613 0.000549 8_LoadFTPlugin()
1 0.000445 56_define_commands()
2 3.323722 0.000407 3_SynSet()
1 0.000316 0.000271 14_EchoFuncInitialize()
2 0.000208 HtmlIndent_CheckUserSettings()
2 0.000183 56_Map()
1 0.000220 0.000172 FugitiveExtractGitDir()
1 1.665048 0.000166 dist#ft#FThtml()
2 0.002720 0.000149 10_LoadIndent()
1 0.000215 0.000144 fugitive#Find()
1 0.000184 0.000099 56_TempReadPre()
5 0.000091 60_AddBlockTag()
1 0.001002 0.000084 fugitive#Init()

That indicates that script 67 in the output of `:scriptnames` is causing
some slowdown. So to the OP: please show the output of :scriptnames or
better, even use :67scriptnames and show the top of the file.

That function is not in the default syntax plugin for css files, so it
must come from somewhere else.

If that is causing problems, you might want to disable that script (or
delete it if you do not need it). Looks to me like some kind of
un-needed plugin that can be disabled and then Vim should be performant
again :)

Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Eugen Sinn
Reply all
Reply to author
Forward
0 new messages