3

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 ) ?

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.