Emacs: Show Line Numbers
Display Line Numbers Mode
new in Emacs 26 (released in 2018-05).
- show line numbers in all buffers.
- show line numbers in current buffer.
Put this in your Emacs Init File:
(when (version<= "26.0.50" emacs-version ) (global-display-line-numbers-mode))
They are written by Eli Zaretskii. Thank you Eli.
Jump to a Line Number
- move cursor to a given line position.
Emacs 23.1 (released 2009-07).
It's a hack, and slows your emacs into a crawl if you have a thousand lines.
- toggle line number in current.
- toggle line number in all buffers.
To set it permanetnly, put this in your Emacs Init File:
How to Set Linum Line Number to Start at 0
If you want line number to start at 0, put this in your Emacs Init File:
(require 'linum) (setq linum-format (lambda (line) (propertize (number-to-string (1- line)) 'face 'linum)))
Setting line number to start at 0 is useful because some editors do that. See: bug#4274.
linum-mode is written by Markus Triska. Thanks Markus.