Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What line numbering plugin is this? Looks very similar to vim numbers. I've been trying to find something like that for emacs for a while now. All I found wasLinum mode, which clutters the UI and doesnt give relative line numbering.


Hey, I'm using relative-number: https://github.com/terhechte/emacs.d/blob/master/plugins/rel...

It mostly works as well as in Vim, except if you're using Code folding, which confuses it a bit.


Why do you want line numbers next to your code at all? Aren't they just visual clutter? The current line number is shown in the mode-line anyway.


Relative line numbers are especially useful when you have mis- or not configured moving by paragraphs/defuns/classes/etc. for some particular mode. C-16 C-p will move the point 16 lines up, for example, supposedly exactly where you want it to be. But that's not the use case I need line numbers for - actually, well configured movement commands + isearch + ace-jump + iy-goto-char + occur is a combo which makes relative line numbering completely unnecessary.

I use (non-relative) line numbers quite often though, and it when I need to tell my colleague that there is this function in some file, on line 323, with a some interesting statement between lines 330 and 336. This makes it extremely easy for them to get to where I am and see exactly what I see; and on the other hand I don't need to move point to those three lines to read their numbers or - absolutely nightmarish - to count the positions manually - they are just there, for me to see.

It would be better to show and hide linum with some simple binding, but I'm already used to them, so it's not a big deal for me.


At least in Vim, line numbers help to move around and operate on text really quickly.

Move cursor to ninth line above: 9k

Delete from here to seventh line below: 7dd

Copy thirteenth line above after second line below: :-13t+2

Having line numbers always visible (either relative or absolute) helps for doing this operations quickly.


Emacs offers goto-line on M-g g or M-g M-g, which admittedly is not the handiest of key sequences; I've been thinking about rebinding that to be more useful, but I don't use it often enough to really need to.

Line numbers are also useful, for example, when doing web development, and hunting down the line that's mentioned in a stack trace. Absent integration between the browser's debugger and Emacs, which is something I've fiddled around with (based on mozrepl) but never got working, that's a good second best.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: