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 9018077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T04:25:49+00:00 2026-06-16T04:25:49+00:00

I have a set of small functions in VimL highlight a line (or a

  • 0

I have a set of small functions in VimL highlight a line (or a word) depending on certain conditions.

You should consider the workings of the functions to act similar as the spelling (:set spell), underlining when the conditions are met.

I have found, however, that when the number of highlighted lines exceed about 75, there is a significant lag when moving. Either from side to side or up or down.

I had some convenient AutoCommands that I was enabling by default, (for example, to echo why the line is highlighted) but even with all of them disabled, as soon as I call the function that highlights everything, I can tell there is a huge lag.

This is what I am using to highlight a word:

call matchadd('MyCheck', '^\%'. line . 'l\_.\{-}\zs\k\+\k\@!\%>' . column . 'c')

And this is what I use to highlight the whole line

call matchadd('MyCheck', '\%' . line . 'l\n\@!')

The 75 number I use as a reference for determining a lag is just a reference, it is a bit of a sweet spot for me, but just to demonstrate that most anything beyond gets increasingly worse.

I also use the SpellBad highlighting for MyCheck, but seriously doubt that this causes any problems.

Is there something I could do differently to avoid the lag? Is matchadd the best option?

EDIT:
Just to make sure it is not any of my functions or code doing something weird, I opened a 500 line file and did this:

highlight link MyCheck SpellBad                                                      
for line in range(line('$'))
    call matchadd('MyCheck', '\%' . line . 'l\n\@!')
endfor

Which basically highlights every single line on the file. Everything clearly got impossibly slow.

  • 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-16T04:25:50+00:00Added an answer on June 16, 2026 at 4:25 am

    Unsetting cursorline has a drastic (positive) effect in performance.

    I did :set nocursorline and now my movements (regardless of highlighting) are snappy as before.

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

Sidebar

Related Questions

After years of programming, we all have a set of small functions used as
I have to implement an application in which I have set small edittext for
I have a set of small images which is working fine in Firefox but
I have a set of relatively simple electrical circuits. Small ones involving just resistors,
We have a small data set and would like to search through it in
i have a small problem where my mandelbrot set is represented as a heightmap
I have a small shell application that embeds Tcl to execute some set of
In my c# application i have this small form which is used to set
I have a set S of small trees S[i] which I need to find
If I have a set of small string values, and I want to fetch

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.