Turn off linum-mode when file is too big
off linum-mode when file is too big :en:emacs:wc:linum:mode:
It's well known that linum-mode slows Emacs when the file contains thousands of lines.
Here is the fix,
(defun buffer-too-big-p () (or (> (buffer-size) (* 5000 80)) (> (line-number-at-pos (point-max)) 5000))) (add-hook 'prog-mode-hook (lambda () ;; turn off `linum-mode' when there are more than 5000 lines (if (buffer-too-big-p) (linum-mode -1))))
You can check the interesting discussion about git-gutter/linum-mode/nlinum-mode. Syohei Yoshida made git-gutter 95% functional when linum-mode off.