Numbering lines in emacs

A few ways to add line numbers in emacs:

  • M-x linum-mode <RET> will annotate the buffer with line numbers. (These numbers are decoration, in the "fringe" rather than part of the buffer text.) Also see Linum Plus.

  • C-x r N will insert line numbers into the selected region. (These numbers are content, they are added to the text of the buffer.)

  • M-x line-number-mode <RET> show the line number of the current line in the modeline.

  • C-x l will report (in the minibuffer) the total number of lines in the current buffer as well as the number of lines before and after the cursor

  • M-x what-line <RET> will report (in the minibuffer) the current line number

Also see emacswiki.org/LineNumbers.

Published 13 May 2013
Tagged emacs.

 

This page was generated at 4:16 PM on 26 Feb 2018.
Copyright © 1999 - 2018 Rodney Waldhoff.