Bash Shell

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.

Profile Photo for Lowell Heddings Lowell Heddings
Lowell is the founder and CEO of How-To Geek. He’s been running the show since creating the site back in 2006. Over the last decade, Lowell has personally written more than 1000 articles which have been viewed by over 250 million people. Prior to starting How-To Geek, Lowell spent 15 years working in IT doing consulting, cybersecurity, database management, and programming work.
Read Full Bio »