0

I frequently use block comments to disable sections of terraform code using /* to start disabling and */ to complete. As expected, the code will turn "grey" and lose syntax highlights.

However, when I move the cursor so that the opening /* scrolls off the top of the screen, the previously "grey" code suddenly starts highlighting again. If I stop moving and CTRL-L to redraw the problem goes away and the code goes "grey" again - although in some unidentified cases redraw never fixes this - it's a little frustrating as I never am sure what code is live or not.

I'm on Windows, using VIM 9.0, the vim-terraform pack, gruvbox colorscheme

I believe I did not have this issue to such a great extent with Vim 8.0. I recall attempting Vim 8.2 and reverting to 8.0 after a few days and I'm only seeing this issue again since updating to 9.0 and it's pretty annoying.

I'm not sure if this is a problem with syntax file, colorscheme file or gvim itself - so any pointers on how to narrow it down?

Cheers Pete

3
  • What "vim-terraform pack"? If it provides a syntax script then you should use their issue tracker.
    – romainl
    May 20, 2023 at 12:32
  • 1
    Sounds like a syntax sync issue; there are some things you can do to increase the sync range, but it might be a symptom of how the syntax file is constructed.
    – D. Ben Knoble
    May 21, 2023 at 20:47
  • I've added a link to the terraform plugin I'm using. I have logged a ticket there - but I wasnot sure if the issue was syntax or colouring or something else. May 22, 2023 at 14:45

1 Answer 1

0

The comments in the thread for this issue led me to add the following to my vimrc:

  "To keep syntax active?
  "https://github.com/vim/vim/issues/2790
  set redrawtime=10000 
  set regexpengine=1 "old engine explicitly

I had redrawtime only and that appeared to fix the issue, but it did not seem to be reliable..

EDIT: I've set this in my _vimrc and for now seems to be working..

syntax sync fromstart
1
  • I take it back - this solution eventually became unreliable too. I'm not sure why it works sometimes and not others Jun 26, 2023 at 16:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.