
You tried relative line numbers, and you liked it. If the relative line numbers are already toggled, setting this option will disable relative line numbers. The same nifty trick applies for relativenumber: If the relative line numbers are turned off, you can turn them on using ':set relativenumber!' or with ':set rnu!' command for short. This will entirely disable the left column that shows the line numbers. You will see relative line numbers to the above and below the line that your cursor is on.įor any reason, if you do not end up liking it, you can turn off relative line numbering using the ':set norelativenumber' command or with 'set nornu' command for short. Now type 'set relativenumber', or you can type 'set rnu' (for short) and hit the Enter key. There should be a colon character printed to the bottom-left corner of Vim. Showing relative line numbers in Vim from an active Vim session You do not have to do the mental math of subtracting the current line number from the line number, and you can go to a specific line in Vim easily. This is particularly useful because moving the cursor up and down x number of lines gets easier. When you have relative line numbers enabled, it means that the line you are currently on is line number 0 and the lines above and below the cursor are consecutively numbered 1, 2, 3. If you no longer wish to have them, simply delete the line 'set number' from your user's '.vimrc' file. Next time you open Vim, you will always see absolute line numbers in Vim. Open the '.vimrc' file using your favourite text editor - vim ~/.vimrc.

If you want changes to be permanent, you can save your preferences in a '.vimrc' file that lives in your user's home directory. The same goes for ":set nonumber!" command. If the line numbers are already displayed and you use this command again, it will stop showing line numbers.

You should now see line numbers to the left side of the window.įor any reason, if you do not end up liking it, you can turn it off using the ':set nonumber' command or with 'set nonu' command for short.Īctually, ":set number!" command works like a switch. Now type 'set number', or you can type 'set nu' (for short) and hit the 'Enter' key. There should be colon character printed to the bottom left corner of Vim. You can switch to the command mode by pressing the Escape (Esc) key.

See “:help initialization” within vim for more details. It can also be used to skip all initializations by giving the name “NONE”. Use this to edit a special kind of files. All the other initializations are skipped. From the vim man page you can see what this will do: In order to start a fresh, clean, default vim instance you have to start your editor with the option -u set to NONE. Reset any option to each default value (whatever that might be).Disable/reset options that I will call switches.Get the currently set options and their values.Start a clean instance of vim with all its default options that ignores all the settings in all the user defined configuration files.This file is usually called vimrc and is located under your home catalog.īut what happens if you wish to reset the value of an option you have configured in this configuration file for just this window that you are currently working in? I found that to be more difficult than expected so, here is how you can: Vim is a very powerful text editor and as such it has lots of options which allows you to configure it “just right” for you! In order to configure it you can set up values to its various options either in the current window you are working on or in configuration file so that every new instance launched will have common settings.
