I know
:set number
and
:set nonumber
I want to know whether there is any command in vi/vim
:set togglenumber
to display line number if the line numbers is not showing or hiding line numbers if line numbers is showing.
If you're already in vi, you can use the goto command. To do this, press Esc , type the line number, and then press Shift-g . If you press Esc and then Shift-g without specifying a line number, it will take you to the last line in 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.
To turn on relative line numbers: Press Esc to enter command mode. Press colon (:). Type set relativenumber (or set rnu), then press Enter.
You can use (on VIM at least):
:set invnumber
More Info:
:set number Turn line numbers on :set nonumber Turn line numbers off :set invnumber Toggle line numbers :set number! Toggle line numbers :set number& Set option to default value :set number? Show value of option
source: http://vim.wikia.com/wiki/Managing_set_options#Boolean_options
In vim, many options support this set
pattern, (for example, foo
):
"enable the option set foo "disable it set nofoo "toggle the option set foo! "get option's current value set foo?
for number
, map a key to :set nu!
would be ok.
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