I covered an ultra quick start on how to get into Vim recently, and now it's time for a related Vim tip.
Being a bit of a geeky text editor, Vim is often used for programming. And in programming, having line numbers easily visible can mean the difference between hunting for a bug for half an hour or finding and correcting it within a few seconds.
Now, it is possible to jump straight to a line of your choice in Vim, but sometimes it can certainly be beneficial to see the line numbers at the side for quick and easy reference. Thankfully, that is very easy to do.
In command mode, simply run the command:
To turn it back off, run its opposite number:
You can also set either of these settings as your default by adding the same command to the bottom of the file .vimrc in your home directory (if it doesn't exist, simply create it).
$ vim .vimrc
And there you go - line numbers!