Some overview and history.
Environment:
- OS: Windows 8.1
- Emulator: cygwin (mintty)
- Terminal: xterm-256
- Vim: v8.0 (Cygwin edition)
- Vim setup:
- Plugin manager: VimPlug
- Enabled plugins:
Plug 'scrooloose/nerdtree', { 'on': 'NERDTreeToggle' } Plug 'vim-airline/vim-airline' Plug 'preservim/nerdcommenter' Plug 'sakshamgupta05/vim-todo-highlight' Plug 'Shirk/vim-gas' Plug 'sheerun/vim-polyglot' Plug 'vim-jp/vim-cpp' Plug 'aserebryakov/vim-todo-lists' Plug 'vim-scripts/ironman.vim' Plug 'mhartington/oceanic-next' Plug 'sonph/onehalf', { 'rtp': 'vim/' } Plug 'chriskempson/base16-vim' Plug 'arcticicestudio/nord-vim' Plug 'morhetz/gruvbox' Plug 'altercation/vim-colors-solarized' - Color mode: 256
- Enabled mouse support
- Backgroud: dark
- Current highlighting fixes (don't work):
autocmd BufEnter * :syntax sync fromstart syntax sync fromstart syntax sync minlines=100 let c_minlines=100 set redraw=1 set redrawtime=100 autocmd FileType cpp syn sync fromstart
History:
It was a normal day when I was working in the Vim editor under cygwin... And I began feel that the Vim editor was lagging. After this occasion, I have done some research and I haven't found where is the problem. So... after some days my Vim became normal i.e. didn't lag.
I have switched to an other code editor but from some reasons I needed use Vim for edit C++ files. When I was editing C++ files my Vim started break syntax highlighting randomly when I was editing strings.
I said it's fine and I have done some research for this problem but again I haven't found any answer. I have continued use Vim with not minding this problem. But AGAIN after some days, when I was editing two C files in vsplit mode, my syntax highlight in the right file have broke.
Overview
- Syntax highlighting doesn't break when I run Vim in the clean mode (
vim --clean ...). - Syntax highlighting with vertical split breaks only in large (100+ lines) and specific files.
- Syntax highlighting with strings usually breaks in large files (100+ lines).
Conclusion
I have asked much people count about this problem, no one knows the answer. Please help me solve this problem!
If it need I can provide my full 'vimrc' file on the pastebin.
vim --cleanto confirm the issie is not related to your vimrc settings or plug-ins. See also:help :syntimefor a command that would help you run a profiler on syntax rules, it might be helpful in understanding why syntax is slow in the specific files you're having trouble with. If you can reproduce it with a specific file, any chance you can share it? – filbranden Jun 20 '20 at 13:51vim --clean? Is the breakage related to lagging or is it visual artifacts? It might also be related to your terminal, when Vim is trying to redraw the screen when scrolling. That makes a lot of sense, since with vsplit it needs to work much harder to do that... – filbranden Jun 20 '20 at 14:07vim --cleandoesn't break syntax. Does it present lagging though? Ifvim --cleansolves your problem, that means the issue is with a plug-in or with a vimrc setting. See How to debug my vimrc file? for suggestions on finding which plug-in or setting causes the issue. – filbranden Jun 21 '20 at 15:40vim-jp/vim-cppandsheerun/vim-polyglot? These ship different versions of the C and C++ syntax files... Since you mentioned things work undervim --clean(where these plug-ins will be inactive), perhaps dropping them will help? – filbranden Sep 07 '20 at 14:07syntax sync fromstartdoesn't work, do you mean it doesn't fix the highlighting if you run it in the buffer where the highlighting is broken? Or did you put it in your.vimrcalong with the other configuration lines that you pasted? – Rich Sep 07 '20 at 16:23