Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8383361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T17:08:43+00:00 2026-06-09T17:08:43+00:00

Sometimes when I’m working on a project I want to play around with some

  • 0

Sometimes when I’m working on a project I want to play around with some data. Often times the data is on one line and is huge (>25k characters). I understand I could set nowrap and have this line just run off the screen, but I tend to like set wrap for other reasons. So, as a workaround I want to hide these long lines in a marker fold (e.g. {{{ long line }}}). This works fine but I run into a problem with synmaxcol for some reason. If the folded line exceeds synmaxcol then when I open the file, the syntax highlighting runs over. For example:

enter image description here

However, as soon as I open the fold the syntax corrects itself:

enter image description here

Having to open the fold every time is annoying though. As you can see in this example the line is not actually all that long — it just exceeds synmaxcol. Since synmaxcol is exceeded at a “string” element, the rest of the file is highlighted as a string (so nothing but a singular double quote will stop it).

Why is this happening and how can I fix it? I’ve tried this with different syntax files and filetypes and it still occurs. I’ve also tried it with no plugins, a minimal vimrc (containing only syn on) and a modeline to set fdm=marker:synmaxcol=60 and it still happens.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T17:08:44+00:00Added an answer on June 9, 2026 at 5:08 pm

    You can manually enter :syntax sync fromstart to force Vim to rescan the syntax from the beginning of the opened file.
    I would suggest defining a hotkey for convenience:

    noremap  <F5> <Esc>:syntax sync fromstart<CR>
    inoremap <F5> <C-o>:syntax sync fromstart<CR>
    

    Now you can press F5 to clean up most syntax highlighting problems.

    Also, have a look at Vim’s fixing syntax highlighting – wiki page
    Moreover reading :help :syn-sync-first might shed some more light on the issue.

    UPDATE:

    I was able to reproduce this behavior on my machine (I’m running Vim 7.3.429).
    However, when I wrapped the fold markers {{{ and }}} in block comments, vim correctly rendered the syntax. You can create appropriately wrapped fold-markers using the zf command. See Vim tips: Folding fun.

    Normally Vim picks the correct blockcomment string based on the currently active syntax. However, my Vim is pretty vanilla and didn’t recognize Ruby syntax. I could specify autocmd FileType ruby set commentstring==begin%s=end in my .vimrc file to set the proper block comment. See :fold-create-marker for more details.

    Another solution is to set synmaxcol=0, which will effectively set it to infinity. This causes Vim to check the syntax of the entire line, no matter how long it is. However, I’m not sure what kind of performance penalty you’ll have to pay for that.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Sometimes I want to have temporary comments fully left justified on a line (//)
sometimes the script(in the web-browser) is packed in one line function a(b){if(c==1){}else{}} . I
Sometimes I need to quickly extract some arbitrary data from XML files to put
Sometimes you come by Zip files with file or directory with some unrecognized characters
Sometimes I feel the urge to put some more expressiveness in my git commit
Sometimes, tomcat restart will cause my application stop immediately so that my consuming data
Sometimes I have to check for some condition that doesn't change inside a loop,
Sometimes the MCI device shows Incorrect Media Length for some particular media. I searched
Sometimes, or well, pretty often i need to see if a String is null
Sometimes I want to run a maximum amount of IO actions in parallel at

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.