How to disable Vim relativenumber setting?

Today I discovered the vim relativenumber option. I really would like to use it, but sometimes I need to exchange between relative numbering and classical numbering.

enter image description here

I tried to disable it using the :set relativenumber=off parameter (which returns the error above) and again using :set number , but none of them work.

+8
source share
5 answers

To enable relative line numbering, use this:

 :set rnu 

To disable it, use this:

 :set nornu 

By the way, if you had Googled for your question, you would find this great post that discusses things in more detail.

+13
source

To enable any option in vim:

 :set <option> 

To disable any option in Vim:

 :set no<option> 

Turn on / off option:

 :set <option>! 

To check if the option is enabled:

 :set <option>? 

To return the default setting:

 :set <option>& 
+3
source

I just use this switch in my vimrc file.

 function! NumberToggle() if(&rnu == 1) set nornu else set rnu endif endfunc nnoremap <Cl> :call NumberToggle()<cr> 
+1
source

Relative numbering is not included by default in vim, which means that you probably include it through your ~/.vimrc file or one of your plugins. Search for set relativenumber or set rnu .

To disable it for the current vim session, you simply run set norelativenumber or set nornu for short. This is a common vim template for turning on and off such settings. For example, spell checking set spell for activation and set nospell for deactivation.

To find this information and much more regarding relative numbering, I recommend that you familiarize yourself with the vim help docs. For this case, when in vim run :h relativenumber

0
source

In fact, you have hybrid mode turned on (the line number on which your cursor is located is marked as the absolute line number, not 0 ). In this case, both nu and rnu are included. You need to delete both to remove line numbers:

The following should work:

set nornu nonu

0
source

All Articles