chrisbra/vim-zsh

Whole piece of code displayed as string

glacambre opened this issue · 5 comments

Affected versions: VIM 8.0, NVIM 2.0.1

When running the following:

nvim -U NORC
:r !wget -qO 'https://raw.githubusercontent.com/zsh-users/zsh-autosuggestions/14179d869d75f4d6b866ca72c5c349fb238c634e/zsh-autosuggestions.zsh'
:syntax on
:set ft=zsh

Lines 519-692 will be displayed as strings. Refreshing the display (e.g. <C-L>) while on line 692 will not change the syntax highlighting, however jumping to line 519 (by doing ':519' instead of repeatedly pressing 'k') will fix it, but jumping to the end of file again (e.g. 'G') will make the problem reappear. Modifying the file while on line 692 will not change anything, modifying the file while on line 519 will fix the problem permanently.

I think this is probably a problem with the syntax highlighting engine rather than the vim-zsh syntax file, however I haven't encountered this issue with any other syntax file, hence my opening an issue here rather than in the official Vim repo.
Please let me know if this isn't the right place for this issue.

I am not sure, I understand. If I open the file which only has 691 lines and go straight to the bottom, I see syntax highlighted comments. What it apparently does not highlight, is those special zsh specific functions. But I find it acceptable

This is what the bottom of the file looks like on my computer: https://my.mixtape.moe/uqqmyn.png. The bug happens every time on my end, I don't know what the difference between your setup and mine might be.
I'm running using Gentoo and urxvt but I doubt it makes a difference.

Interesting, I cannot reproduce. Can you check the methods described at :h :syn-sync

Using :syntax sync fromstart or :syntax sync minlines=1000 solves the issue but I still don't understand why the second half of the comments isn't the same color as the first half.
It seems that somehow the size of the window is important too, the bug isn't triggered if the window is less that 56 lines tall.
It's really starting to look like a vim bug instead of a vim-zsh bug in my opinion, should I open an issue in the vim repo?