Showing line numbers in dired file browser in Emacs

153 Views Asked by At

I am unable to show line numbers in Emacs when browsing files using Dired.

   Dotspacemacs-line-numbers '(:relative nil
     :visual t
     :disabled-for-modes ;; dired-mode
                         doc-view-mode
                         markdown-mode
                         ;; org-mode
                         pdf-view-mode
                         ;; text-mode
     :size-limit-kb 1000)

but line numbers are not showing.

any idea how to enable line numbers in Dired?

1

There are 1 best solutions below

2
Drew On

Turn on minor mode display-line-numbers-mode: M-x display-line-numbers-mode. C-h f tells you:

display-line-numbers-mode is an autoloaded interactive compiled Lisp function in display-line-numbers.el.

(display-line-numbers-mode &optional ARG)

Toggle display of line numbers in the buffer.

This uses display-line-numbers internally.

This is a minor mode. If called interactively, toggle the Display-Line-Numbers mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate display-line-numbers-mode.

The mode’s hook is called both when the mode is enabled and when it is disabled.

To change the type of line numbers displayed by default, customize display-line-numbers-type. To change the type while the mode is on, set display-line-numbers directly.

Probably introduced at or before Emacs version 26.1.