Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to take off line numbers in Vi?

Tags:

vi

editor

numbers

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

set numbers

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

like image 654
user710818 Avatar asked Nov 30 '11 08:11

user710818


People also ask

How do I show line numbers in less command?

You can easily display line numbers using less command. All you have to do is pass either -N or --LINE-NUMBERS option to the less command. This option forces less to show a line number at the beginning of each line in the screen.


6 Answers

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

like image 125
Narayan Avatar answered Oct 01 '22 20:10

Narayan


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.

like image 42
Alex Avatar answered Oct 01 '22 21:10

Alex


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

set nonumber
like image 43
Jugal Shah Avatar answered Oct 01 '22 22:10

Jugal Shah


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

  1. :set nu!
  2. :set nonu
  3. :set number!
  4. :set nonumber
like image 40
Matt Avatar answered Oct 01 '22 22:10

Matt


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 
like image 34
Kaleem Ullah Avatar answered Oct 01 '22 20:10

Kaleem Ullah


set nonumber
set norelativenumber

If you are using some vim bundles.

like image 36
dezhi Avatar answered Oct 01 '22 22:10

dezhi