You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Syntax highlight getting lost when jumping down large file #634
I have not noticed this problem as much in earlier versions of MacVim and it is not an issue editing the same file on Windows using Gvim.
If I load the file and set the syntax to Asciidoc the highlighting looks fine. However if I then do a search that requires jumping way down the file or if I just manually jump to the end of the file, syntax highlighting is lost. Doing a syntax sync fromstart does not bring it back and setting the syntax back to Asciidoc again only seems to work if I jump back to the top of the file and manually scroll down the file. As soon as I jump down the file again same problem. This seems to have started happening since I updated to this version of MacVim.
My OS is MacOS 10.13.3
I have sometimes seen this behaviour before but never until now encountered a case where doing a syntax sync fromstart does not fix it.
I am experiencing the same problem in a very long (>3500 lines) bash file. When scrolling down, at certain line syntax gets lost and is uncoverable by syntax sync fromstart.
VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Feb 18 2018 04:09:42)
Included patches: 1-1522
Is there any public examples to check this issue? I have many Python files >3500 lines long but MacVim never looses syntax highlighting with syntax sync fromstart.
I listed a way to reproduce this in my initial entry above @eirnym . The file needs to be longer than 3,500 lines I think. I see it in files in the order of 40K lines and it is 100% reproducible.
Got the same issue with a file with very long lines (from a mysql dump sql file). If lines have reasonable length, everything works like a charm even with huge files. If I chop long lines with RE to smaller ones, problem will "magically" gone
Is this a MacVim issue, though? If I open the OP's Asciidoc file in terminal Vim with vim --clean, syntax highlighting is initially on, but if I press G syntax highlighting is turned off. Also, Vim hangs for a couple of seconds when I press G, which makes me believe that something wrong is happening with some regular expression from Asciidoc's syntax file (or Vim's search simply times out).
Thanks I will try this. On MacVim I am seeing syntax highlighting get lost a lot more often these days even on small files of many different types. So (for me anyway) it is not limited to Asciidoc files any more.
I use Macvim ,most of the time it works fine,except with HTML/VUE files;When I'm editing HTML/VUE/CSS files,highlight usually failed when jump with G or Ctrl+f.Really need some help.It troubles a lot
This issue was with ViM engine all the time. ViM engine cuts what is far away before and far away after the visible screen to speedup highlighting process. In comparison IntelliJ Idea IDEs hold whole AST in the memory and just turn off syntax highlighting for large files.
To minimize impact of this issue for me, I prefer to have restrictions like listed below.
no wrapping
lines are not very long (95% at least not longer than visible
use as best syntax files for specific highlighting as possible
if file could be broken, I prefer to have it in pieces.
the better if syntax context is within +- 30-50 lines before and after the visible screen.
yes, sometimes I read (not edit much, thankfully) files 2Gb+ long with JSON and/or SQL with syntax formatting turned on.
As others have said this is mostly a general issue with Vim's highlighting and there are different ways to solve it including what the previous comment said or using a longer redrawtime. I was mostly curious if there are specific MacVim performance issues but I tried different large files but I couldn't see one that only affects MacVim and not normal Vim. I'm going to close this issue soon unless someone can give a concrete example of this affecting only MacVim.
Activity
smiglo commentedon Mar 13, 2018
I am experiencing the same problem in a very long (>3500 lines) bash file. When scrolling down, at certain line syntax gets lost and is uncoverable by
syntax sync fromstart.FFEVER commentedon Jun 21, 2018
The same problem.
eirnym commentedon Jun 21, 2018
Is there any public examples to check this issue? I have many Python files >3500 lines long but MacVim never looses syntax highlighting with
syntax sync fromstart.FFEVER commentedon Jun 21, 2018
I've found my solution.
:syntax enablewill take back the syntax highlight.I don't know why but it works.
(Mine is >5000 lines of scss file.)
krlawrence commentedon Jul 9, 2018
I listed a way to reproduce this in my initial entry above @eirnym . The file needs to be longer than 3,500 lines I think. I see it in files in the order of 40K lines and it is 100% reproducible.
eirnym commentedon Jul 9, 2018
Got the same issue with a file with very long lines (from a mysql dump sql file). If lines have reasonable length, everything works like a charm even with huge files. If I chop long lines with RE to smaller ones, problem will "magically" gone
eirnym commentedon Jul 9, 2018
My file was ~3k lines long and after chopping it is about 100k long
lifepillar commentedon Aug 20, 2018
Is this a MacVim issue, though? If I open the OP's Asciidoc file in terminal Vim with
vim --clean, syntax highlighting is initially on, but if I pressGsyntax highlighting is turned off. Also, Vim hangs for a couple of seconds when I pressG, which makes me believe that something wrong is happening with some regular expression from Asciidoc's syntax file (or Vim's search simply times out).lifepillar commentedon Aug 20, 2018
Try this: open a long file, turn syntax debugging on with
:syntime on, then pressG. I see this message:Use
:syntime reportfor timing details: e.g., matchingasciidocLiteralParagraphalone takes over half a second.So, the solution is either to increase
redrawtimeor (better) ask the developer of the Asciidoc syntax file to optimise the syntax file.krlawrence commentedon Oct 28, 2018
Thanks I will try this. On MacVim I am seeing syntax highlighting get lost a lot more often these days even on small files of many different types. So (for me anyway) it is not limited to Asciidoc files any more.
xiaotianhu commentedon Apr 1, 2019
I use Macvim ,most of the time it works fine,except with HTML/VUE files;When I'm editing HTML/VUE/CSS files,highlight usually failed when jump with
GorCtrl+f.Really need some help.It troubles a loteirnym commentedon Apr 1, 2019
This issue was with ViM engine all the time. ViM engine cuts what is far away before and far away after the visible screen to speedup highlighting process. In comparison IntelliJ Idea IDEs hold whole AST in the memory and just turn off syntax highlighting for large files.
To minimize impact of this issue for me, I prefer to have restrictions like listed below.
yes, sometimes I read (not edit much, thankfully) files 2Gb+ long with JSON and/or SQL with syntax formatting turned on.
ychin commentedon Apr 3, 2019
As others have said this is mostly a general issue with Vim's highlighting and there are different ways to solve it including what the previous comment said or using a longer
redrawtime. I was mostly curious if there are specific MacVim performance issues but I tried different large files but I couldn't see one that only affects MacVim and not normal Vim. I'm going to close this issue soon unless someone can give a concrete example of this affecting only MacVim.