5

I have emacs 26 installed and helm.

I would like to disable line numbers in helm buffers ( and other buffers that has no use of line numbers)

enter image description here

is there anyway to disable the native line number in those buffers or even better disable it in everything except buffers that has code ( buffers with filenames ) ?

Ayed
  • 185
  • 5

1 Answers1

6

To only enable line numbers in "buffers that have code", you could add a hook to prog-mode-hook:

(add-hook 'prog-mode-hook #'display-line-numbers-mode)

(or whatever line numbering mode/function you're using), and make sure you don't have global-display-line-numbers-mode somewhere in your init. However, "buffers with filenames" and "buffers with code" don't mean the same thing - only buffers with prog-mode derived major modes (which includes most major language modes) will get line numbers with this method.

You could add display-line-numbers-mode to something like find-file-hook to have it turned on whenever a file is visited.

dieggsy
  • 475
  • 2
  • 10