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. Limit highlighting per line
- Add set synmaxcol=200 to ~/.vimrc
- Only the first 200 characters of each line get highlighted
2. Switch regex engine
- Try :set regexpengine=1 (old backtracking engine)
- If faster, add it to ~/.vimrc
3. Disable expensive display options
- :set nocursorline norelativenumber
- :NoMatchParen
- Or :syntax off for one-off huge files
4. Open huge files without plugins
- vim -u NONE bigfile.log
- Or use a LargeFile plugin that disables features above a size limit
5. Update Vim
- 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
- How to Exit Vim (Stuck in Vim)
- Vim Copy to Clipboard Not Working
- Vim E325: ATTENTION Found a Swap File
- Vim E212: Can't Open File for Writing
- Vim E37: No Write Since Last Change
- Vim Backspace Not Working in Insert Mode
- Vim Paste Indentation Messed Up (Staircase Effect)
- Vim Colors Wrong in tmux
- Vim Arrow Keys Insert A B C D
- Vim Requires Python 3 Support Error (YouCompleteMe)
- Vim Modeline Vulnerability CVE-2026-34982