M-x all-things-emacs

Quick Tip: Line Numbering

March 29th, 2007 by Rob Christie · 11 Comments

linum I frequent the gnu.emacs.sources news group as one route to finding out about new packages. linenum.el came across the list recently. The package displays line numbers on the left side of your buffer. The author indicates that it is an alternative to setnu.el with the benefit that it works incrementally and can handle large files. It seems like one of those packages that is nice to have in your bag of tricks. Of course, you may just want the current line number in your modeline by using the M-x line-number-mode command. You can set it by default with the following line in your .emacs file.

(line-number-mode 1)

And in case you forgot (or didn’t know), M-g M-g (or M-g g) is the key binding for M-x goto-line in Emacs 22.

Tags: quick · tips

11 responses so far ↓

  • 1 Rob Christie // Mar 29, 2007 at 2:45 pm

    One of my officemates just pointed out to me that the goto-line key binding is only in Emacs 22. I will update the post. Thanks Andy.

  • 2 Bryan // Mar 29, 2007 at 10:12 pm

    Good tip! I didn’t know about the Emacs 22 keybinding. That’s pretty handy.

    If you just want to know what line you are on occasionally you can ask, M-x what-line.

  • 3 Free Mind » Blog Archive » linum.el: Yet another package for Emacs to display line number // Aug 29, 2007 at 3:39 pm

    [...] setnu.el(??? setnu+.el) ?? wb-line-number.el ???????????? linum.el [...]

  • 4 michigan health saginaw covenant care // Jan 8, 2009 at 10:49 am

    saginaw health mi covenant care saginaw michigan health covenant care

  • 5 chenlevy's status on Thursday, 18-Jun-09 12:56:08 UTC - Identi.ca // Jun 18, 2009 at 12:56 pm

    [...] http://www.emacsblog.org/2007/03/29/quick-tip-line-numbering/ is for #emacs what ``:set number`` is for [...]

  • 6 line numbering in emacs (as in vi) // Jun 8, 2011 at 7:08 pm

    [...] the department.) In vi you just use :set nu – the is a site that explains that this is possible http://emacsblog.org/2007/03/29/quic…ine-numbering/ It describes a linenum.el – and I can see the program, but don't understand how to install [...]

  • 7 giulio // May 31, 2013 at 1:16 pm

    Maybe I’m using wrong linenum.el, but line numbers appear as a part of the buffer to me, so that typing return doesn’t add a new line with a new number , but instead put my cursor between two line numbers.
    There’s a way to change this behaviour a gedit-like one? There numbers line are automatically refreshed by typing and cannot by modified or navigated with cursor keys, backspace and del.
    Any idea?

  • 8 http://www.fullcontracting.com // Jul 2, 2015 at 4:27 am

    ... [Trackback]

    [...] Find More Informations here: emacsblog.org/2007/03/29/quick-tip-line-numbering/ [...]

  • 9 repair wall cracks // Jul 2, 2015 at 5:32 am

    ... [Trackback]

    [...] There you will find 73763 more Infos: emacsblog.org/2007/03/29/quick-tip-line-numbering/ [...]

  • 10 innertradingcircle // Jul 2, 2015 at 12:30 pm

    ... [Trackback]

    [...] Read More here: emacsblog.org/2007/03/29/quick-tip-line-numbering/ [...]

  • 11 london rat catcher // Jul 4, 2015 at 12:06 am

    ... [Trackback]

    [...] There you will find 97432 more Infos: emacsblog.org/2007/03/29/quick-tip-line-numbering/ [...]