Saturday, June 20, 2009

Vim-style Line Numbers in Emacs

Being a heavy Vim user throughout my university degree and now throughout work, I get very used to having the line numbers down the side (with "set numbers" in a .vimrc) as I hack code. To get something like this in Emacs, there is linum-mode.

You can toggle linum-mode for any Emacs buffer with the command M-x linum-mode. Or if you want to set it globally for every file you edit, add this to your .emacs file:
(require 'linum)
(global-linum-mode 1)
linum-mode should come pre-installed with Emacs 22 and beyond. It is also bundled with Aquamacs 1.7 (and maybe earlier...)

2 comments:

  1. this linum-mode is highly inefficient..

    ReplyDelete
  2. How so? Admittedly I haven't opened any files over approx. 1.5k lines with it, but I'm interested to know how it fares on slower machines and larger source files.

    ReplyDelete