Vim-polyglot
vim-polyglot contains what it calls 'language packs', which are sets of syntax, ftplugin, and other files that 'enhance' the experience of working with a particular language. These files work as explained by the help reference, in particular at :help rtp
and various topics like syntax
, ftplugin
, &c.
Regexes/syntax
Regexes are common to syntax files as a way to define for Vim that, say, var
is a keyword and 123
is a constant. If a regex is 'slow', it will slow down syntax highlighting.
By 'slow' I mean that vim's regex engine has a hard time handling it efficiently; this is always a known limitation of regexes, although for the most part vim handles them quite well.
Fixes
- Suffer through slowness (but this is Vim, not emacs, so I'm going to guess you don't want that)
- Turn off syntax highlighting (apparently there is a trend of people doing this to focus better?)
- Remove your vim-polyglot (consider filing a bug related to your specific language
js
)
- If they then fix the bug, you can reuse the plugin
Lacking the time and effort to fully explain syntax files/the runtime path, I'm going to point any curious readers to here (thank you Steve Losh). In fact, if you haven't already, the whole book there is a good read.