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

  • Home
  • SEARCH
  • 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 6139503
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:59:52+00:00 2026-05-23T17:59:52+00:00

I make extensive use of multiline docstrings in my python source code to include

  • 0

I make extensive use of multiline docstrings in my python source code to include doctests. Unfortunately, vim/gvim seems to have a hard time with syntax highlighting, occasionally losing it’s place and forgetting that it’s in the middle of a string literal, and the highlighting “flips” from string to source and source to string.

I can scroll up to the top and back down again, and vim usually fixes the problem, but sometimes it takes a few tries.

Aside from making my docstrings shorter, Is there a way to help vim keep the highlighting on these long literals in order?

  • 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-05-23T17:59:53+00:00Added an answer on May 23, 2026 at 5:59 pm

    :syntax syn controls how Vim synchronizes the syntax state that should apply at a particular point in the text (:help syn-sync). For the most accurate sync (but this will slow vim down), try:

    autocmd BufEnter * :syntax sync fromstart
    

    Or if you want to sync manually whenever you notice it’s wrong, try this command (you could map it to a keyboard shortcut):

    :syntax sync fromstart
    

    You might also find minlines useful. From :help syn-sync

    If the “minlines={N}” argument is given, the parsing always starts at least
    that many lines backwards. This can be used if the parsing may take a few
    lines before it’s correct, or when it’s not possible to use syncing.

    So putting this in your .vimrc might help you:

    syntax sync minlines=500
    

    Edit: found this page which has everything you need:
    http://vim.wikia.com/wiki/Fix_syntax_highlighting

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

Sidebar

Related Questions

We have a MediaWiki wiki in which we make extensive use of templates. These
Some of my co-workers make extensive use of the VB.net concept of Modules. Unfortunately,
In my web-application, i make extensive use of a database. I have an abstract
In my code I make extensive use of regular expression, and my patterns look
I make extensive use of source control for anything that relates to a project
Web-Applications these days make extensive use of Javascript, for example various Google Products like
In my experience I see a lot of architecture diagrams which make extensive use
I'm trying to make extensive tests for my new project but I have a
At work we make pretty extensive use of Visio drawing as support for documentation.
Our upcoming app will make extensive use of CoreText. Currently I am unaware of

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.