05.11.06

Emacs tips #2 : linenumbers

Posted in Emacs at 11:25 am by theBlackDragon

A question that pops up pretty often is how you can add line numbers in the margin of your files the way most other editors do.

There are actually two ways of doing this:

  • adding the numbers in the margin
  • adding the numbers to your files, so that they get saved with your file, might be useful in certain cases (COBOL source?)

Unfortunately Emacs doesn't support either out of the box, but fortunately people have written modes that do exactly this. Modes for both the former as the latter can be found on the EmacsWiki.

Personally I (occasionaly) use setnu.el which works extremely well for my purposes.

Leave a Comment