How to take off line numbers in Vi?

EditorNumbersVi

Editor Problem Overview


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

set numbers

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

Editor Solutions


Solution 1 - Editor

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

Solution 2 - Editor

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.

Solution 3 - Editor

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

set nonumber

Solution 4 - Editor

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

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

Solution 5 - Editor

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 

Solution 6 - Editor

From the Document "Mastering the VI editor":

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

Solution 7 - Editor

set number set nonumber

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

Solution 8 - Editor

write command in terminal:

vi ~/.vimrc

for set the number:
write set number

for remove number:
write set nonumber

Solution 9 - Editor

set nonumber
set norelativenumber

If you are using some vim bundles.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionuser710818View Question on Stackoverflow
Solution 1 - EditorNarayanView Answer on Stackoverflow
Solution 2 - EditorAlexView Answer on Stackoverflow
Solution 3 - EditorJugal ShahView Answer on Stackoverflow
Solution 4 - EditorMattView Answer on Stackoverflow
Solution 5 - EditorKaleem UllahView Answer on Stackoverflow
Solution 6 - EditorCloudyMarbleView Answer on Stackoverflow
Solution 7 - EditorcharlesView Answer on Stackoverflow
Solution 8 - EditorYash ShahView Answer on Stackoverflow
Solution 9 - EditordezhiView Answer on Stackoverflow