Velvet Star Monitor

Standout celebrity highlights with iconic style.

general

Add line numbers to GNU Emacs

Writer Emily Wong

How can I add line numbers to Emacs?

Please explain, I'm an absolute beginner.

2 Answers

If you're running it in default mode, it's in the menu: Options > Show/Hide > Line Numbers. Then Options > Save Options to save it for future sessions.

If you're running it in a terminal (emacs -nw), then it's M-x line-number-mode. M- is usually the Windows key, but may be Alt, or you can press Esc followed by x.

(Edit: The above only affects the mode line. For line numbers in the margin, you want M-x linum-mode, or more likely (setq global-linum-mode t) in your ~/.emacs.)

4

Add (global-linum-mode t) to ~/.emacs.d/init.el

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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