Ask HN: Why do all editors have line numbers disabled by default?

3 points by louprado ↗ HN
Is there a compelling advantage to having line numbers disabled ? There must be, because nearly every IDE and programming based text-editor disables them by default. Even a recent upgrade to Android Studio undid my make-line-numbers-visible setting.

Are there any developers that disable them if they are enabled ? And if so, how does your co-worker quickly communicate the location your bug during a pairing session ?

1 comment

[ 2.9 ms ] story [ 12.4 ms ] thread
My assumption is that because most people don't really use line numbers actively. This might seem weird since we all go and enable line numbers asap but when I think about it, I rarely use them. If there's an error on line 26 I simply jump to line 26 using whichever shortcut my editor gives me. Line numbers are very poor bookmarks as well. In a constantly evolving code file, what use does bookmarking line 26 have when tomorrow the contents of it could have changed.

Basically the idea behind line numbers is to give a point of reference. Points of reference have two types of uses. Immediate and long term. Immediate reference points in code are good for debugging. For that you have a line jump shortcut. Long term reference points in code are essentially useless as explained. The whole purpose of a reference point is that the contents shouldn't change. In a book, page 37 always means the same thing no matter how much time passes. Not so in code

But why do we all enable line numbers then anyways?? My hunch is that it's some form of comfort usually. In editors like vi it's a little more robust since we use the line numbers to jump usually but I've discovered that as my vim skills have improved I don't jump to a line as often as I jump to a specific word. So with all that taken into account, it feels like line numbers are really one of those things we have an odd relationship with where we take comfort in them being around every now and then but we can get by fine without ever needing them..

Edit. Re pairing sessions. You are right. There are a lot of line number references here. One of the few times that you will be having repeated requirements of immediate reference points to be shared. But this use case doesn't make up the majority of use case of how we develop most of the time. Pair programming will mostly be two people at the same computer (which makes sense. How do you keep the files and therefore the line numbers in sync if you are using two machines). So that again doesn't need line numbers constantly. And so we come back to the main reason it's disabled by default. Because that's the default behavior really