Updated After the discussion of modes and installing packages, we can give some direct
practical trick, courtesy of M-x all-things-emacs; note, I have updated this
since, to work with Emacs 23.
Sometimes it is very useful to see the line numbers in a file – that is, on
the left side of each line, the line number is shown. A use case for this is
when showing something to a group of people. In that case, zooming and
full-screen mode might also be useful.
The traditional way in emacs is to use setnu.el, but it's quite slow for big
files. Fortunately, there is linum-mode
; in your .emacs, add:
(autoload 'linum-mode "linum" "toggle line numbers on/off" t)
(global-set-key (kbd "C-<f5>") 'linum-mode)
Now, you can quickly show/hide linenumbers by pressing C-F5
(Control-F5
).
You can also turn it on for specific modes; for example, to turn on line
numbers when editing Perl code:
(add-hook 'perl-mode-hook
(lambda() (linum-mode 1)))
No comments:
Post a Comment