1. Home
  2. Linux
  3. How to get line number count in vim editor

How To Get Line Number Count In Vim Editor

Vim is one of the most commonly used editors in all Linux based systems. Home users and Server administrators both use the Vim editor to create/edit files. If you have ever edited a large file with Vim then you probably have faced the problem of finding some particular line number. Let me share an easy way to display the line number count in Vim.

In order to make this setting active, we will need to make some small change in the configuration file of the Vim editor. You can find the configuration of Vim in the /etc/vim directory with the name vimrc. Open this file by running the following command in the terminal:

sudo gedit /etc/vim/vimrc

Once the file is opened, navigate to the end of the file and add the following:

set nu


That’s it, now whenever you will open any file with the Vim editor you will see the line count.

Vim Line Number



  1. This is just so typical… in this example, why that vimrc file was not edited with… well, you know… VIM… :)Someone using such a nice editor like VIM wouldn't even think about using gedit for any reason…

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.