How to Turn on Line Numbers in vim

By Lowell Heddings on July 31st, 2017

Vim is an extremely powerful editor, but only if you know how to use it. When you first start out, it’s like getting dumped into Minecraft survival mode — you’re gonna have to punch some trees.

In this case we can easily enable line numbers by simply typing the : character and using the following:

set number

Well that was easy. You’ll start seeing line numbers right away.

The only problem is that the next time you open vim the line numbers will be gone and you’ll have to google how to do this again and then type the command every time. Luckily there’s a way to make settings stick.

Just open up your vimrc file with vim ~/.vimrc and add the command in there. Save and exit and the next time the line numbers will be there again.