For displaying line numbers in a file, I use command:
set numbers
What is the command to clear line numbers from the file?
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.
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
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.
To turn off line numbering, again follow the preceding instructions, except this time enter the following line at the : prompt:
set nonumber
For turning off line numbers, any of these commands will work:
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
set nonumber
set norelativenumber
If you are using some vim bundles.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With