Why Is Vim So Slow? (Large Files & Long Lines)

Workaround available Linux, macOS, Windows Updated October 21, 2026

Quick answer

Syntax highlighting on very long lines is the usual cause. Set synmaxcol=200, try regexpengine=1, and turn off cursorline/relativenumber for big files.

Most likely fix: Limit highlighting per line.

Symptoms

Scrolling and typing lag in big files, minified JSON/JS or long log lines; Vim freezes for seconds; :syntax off makes it fast again.

Why it happens

  • Syntax highlighting regex runs over every character of very long lines
  • The newer NFA regex engine is slower for some syntax files
  • cursorline, relativenumber and matchparen force extra redraws
  • Heavy plugins (linters, statuslines) running on every change

How to fix it

Try these in order — the most common fix is first.

  1. 1. Limit highlighting per line

    1. Add set synmaxcol=200 to ~/.vimrc
    2. Only the first 200 characters of each line get highlighted
  2. 2. Switch regex engine

    1. Try :set regexpengine=1 (old backtracking engine)
    2. If faster, add it to ~/.vimrc
  3. 3. Disable expensive display options

    1. :set nocursorline norelativenumber
    2. :NoMatchParen
    3. Or :syntax off for one-off huge files
  4. 4. Open huge files without plugins

    1. vim -u NONE bigfile.log
    2. Or use a LargeFile plugin that disables features above a size limit
  5. 5. Update Vim

    1. Recent 9.2 patches (e.g. 9.2.1036, Sep 2026) speed up syntax highlighting on large files

This guide also covers

  • why is vim so slow
  • vim slow large file
  • vim lag long lines
  • vim syntax highlighting slow

Still not working?

If Vim keeps failing, you're not alone. See every Vim problem users report or the alternatives people switch to.

Other Vim errors