user710818
user710818

Reputation: 24248

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?

Upvotes: 137

Views: 160474

Answers (9)

dezhi
dezhi

Reputation: 909

set nonumber
set norelativenumber

If you are using some vim bundles.

Upvotes: 3

Yash Shah
Yash Shah

Reputation: 156

write command in terminal:

vi ~/.vimrc

for set the number:
write set number

for remove number:
write set nonumber

Upvotes: 0

charles
charles

Reputation: 11

set number set nonumber

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

Upvotes: 0

Narayan
Narayan

Reputation: 6241

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

Upvotes: 233

Matt
Matt

Reputation: 4752

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

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

Upvotes: 9

Kaleem Ullah
Kaleem Ullah

Reputation: 7049

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 

Upvotes: 3

CloudyMarble
CloudyMarble

Reputation: 37566

From the Document "Mastering the VI editor":

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

Upvotes: 0

Alex
Alex

Reputation: 1678

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.

Upvotes: 22

Jugal Shah
Jugal Shah

Reputation: 3701

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

set nonumber

Upvotes: 16

Related Questions