[editor] How to take off line numbers in Vi?

For displaying line numbers in a file, I use command:

set numbers

What is the command to clear line numbers from the file?

This question is related to editor numbers vi

The answer is


If you are talking about show line number command in vi/vim

you could use

set nu

in commandline mode to turn on and

set nonu

will turn off the line number display or

set nu!

to toggle off display of line numbers


To turn off line numbering, again follow the preceding instructions, except this time enter the following line at the : prompt:

set nonumber

Display line numbers:

:set nu

Stop showing the line numbers:

:set nonu

Its short for :set nonumber

ps. These commands are to be run in normal mode.


write command in terminal:

vi ~/.vimrc

for set the number:
write set number

for remove number:
write set nonumber


Easily Display Line number:

set number flag (to show line number type)

:set nu or :set number

to unset the number flag (hide the line number type)

:set nu!

If you need number every time you start vi/vim, append following line to your ~/.vimrc file:

set number

Open a file at particular location/line number

$ vi +linenumber file.rb
$ vi +300 initlib.rb 

From the Document "Mastering the VI editor":

number (nu)
Displays lines with line numbers on the left side.

set number set nonumber

DO work inside .vimrc and make sure you DO NOT precede commands in .vimrc with :


For turning off line numbers, any of these commands will work:

  1. :set nu!
  2. :set nonu
  3. :set number!
  4. :set nonumber

Examples related to editor

Select all occurrences of selected word in VSCode Change the Theme in Jupyter Notebook? How to view Plugin Manager in Notepad++ Set language for syntax highlighting in Visual Studio Code Copy text from nano editor to shell How do I duplicate a line or selection within Visual Studio Code? How to set editor theme in IntelliJ Idea How to change background color in the Notepad++ text editor? What is the difference between Sublime text and Github's Atom What are the advantages of Sublime Text over Notepad++ and vice-versa?

Examples related to numbers

how to display a javascript var in html body How to label scatterplot points by name? Allow 2 decimal places in <input type="number"> Why does the html input with type "number" allow the letter 'e' to be entered in the field? Explanation on Integer.MAX_VALUE and Integer.MIN_VALUE to find min and max value in an array Input type "number" won't resize C++ - how to find the length of an integer How to Generate a random number of fixed length using JavaScript? How do you check in python whether a string contains only numbers? Turn a single number into single digits Python

Examples related to vi

How to run vi on docker container? Find and replace strings in vim on multiple lines How can I delete multiple lines in vi? Is there a short cut for going back to the beginning of a file by vi editor? vi/vim editor, copy a block (not usual action) How to go back (ctrl+z) in vi/vim How do I exit the Vim editor? vim line numbers - how to have them on by default? Go to beginning of line without opening new line in VI How to take off line numbers in Vi?