1

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.

Hotschke
  • 4,740
  • 26
  • 37
  • Welcome to [vi.se]! Unfortunately your question does not include enough details to allow for some meaningful troubleshooting. I guess my recommendation would be to try opening the problem files with vim --clean to confirm the issie is not related to your vimrc settings or plug-ins. See also :help :syntime for 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:51
  • 1
    Hi @filbranden! Hmm, I will try to do things those you describe in your comment. And no, I can't reproduce those bugs, it does randomly, when I'm working in the editor. – Фёдор Лапшин Jun 20 '20 at 13:56
  • Hmm, interesting. I have run vim in a clean mode and normal mode but my bug don't happens. Well, how I said above it happens randomly. – Фёдор Лапшин Jun 20 '20 at 14:03
  • BUT, I have just reproduced bug with breaking (syntax doesn't highlight) in vsplit mode (first file length - 135 lines, second - 155 lines). – Фёдор Лапшин Jun 20 '20 at 14:05
  • Can you reproduce it with vsplit on vim --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:07
  • Oh, no. I reproduced it in normal mode. Take me a sec, I will reproduce it in clean mode... No, this bug works only in normal mode. By the way, I am using NERDTree with it split, may be problem (with vsplit syntax highlighting) is in it. And no, my vim isn't lagging at the moment when I have reproduced this bug. – Фёдор Лапшин Jun 20 '20 at 14:13
  • But again I can't reproduce bug with "strings" it happens randomly -_-. – Фёдор Лапшин Jun 20 '20 at 14:14
  • 1
    Consider making an [edit] to your question including additional details. Do you think you can capture the problem in a video of some kind so you can actually show what it's like? There are some terminal recording applications such as asciinema (and others), maybe that would make it easier to actually demonstrate the issue? – filbranden Jun 20 '20 at 14:33
  • 1
    Hmm, I will try it soon, and will send here results. Ok? – Фёдор Лапшин Jun 20 '20 at 14:42
  • 1
    Yes. Please [edit] your question to include more details. That should give it more visibility for others who might have a good answer for it! – filbranden Jun 20 '20 at 14:42
  • 1
    @filbranden I have reorganized my question, so you can know more. – Фёдор Лапшин Jun 21 '20 at 13:13
  • Thanks @ФёдорЛапшин ! But it's still.hard to tell what the problem actually is... Syntax breaks with string, can you take a screenshot? You said vim --clean doesn't break syntax. Does it present lagging though? If vim --clean solves 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:40
  • Have you tried dropping plug-ins vim-jp/vim-cpp and sheerun/vim-polyglot? These ship different versions of the C and C++ syntax files... Since you mentioned things work under vim --clean (where these plug-ins will be inactive), perhaps dropping them will help? – filbranden Sep 07 '20 at 14:07
  • When you say that syntax sync fromstart doesn'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 .vimrc along with the other configuration lines that you pasted? – Rich Sep 07 '20 at 16:23

0 Answers0