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)))
8 comments:
Hi Djcb! welcome on panet emacsen :) Nice to read you there too.
I think the version of linum.el you linked to is pretty old. The home page has a much newer version.
You have some great and helpful posts here.
Thanks!
@Jason: thank -- updated the link.
Another fix, instead of calling linum, it should be calling linum-mode.
@Luizão: 'linum' works for me at least...
Cool blog, thanks for the info.
For me as well, the second linum needs to be linum-mode or the F6 shortcut doesn't work.
I have updated this post now, and it should all work for Emacs 23.
Post a Comment