I've seen so many examples/usages about how to display/hide line numbers in vi edit mode.
To turn on line numbers: Type :set number
in edit mode
To turn off line numbers: Type :set nonumber
in edit mode
I wonder whether there is any convenient way/option available (that I may not be knowing) to specify/mention this option at the time of opening the file from the command line?
NOTE: For example, to go to a specific line inside a file after opening it, we can conveniently say vi +/<linenumber> <filename>
from the command line.
You can use:
How about if you create a separate vim settings file for both cases? For example,
~/.vimrc-number
and~/.vimrc-nonumber
. Then you can launch those like this:Or create aliases to your
.bashrc
:You can use:
or put "set number" to your ~/.vimrc
If wrongly answered your question first. My answer was:
The exact syntax, to jump to a line is :
or
Where linenumber is a number.
And the correct answer to your question is:
Which will provides lines number while editing filename.
Looks to me like you answered your own question; Maybe you need to rephrase the question?? :D
vi +LINENUMBER nameoffile
If you want to have the line numbers and to jump to the line number you can use the +"set number" and +linenumber :
vi +set\ number your_file +171
One can use alias, add
alias vim='vim +"set number"'
to ~/.bashrc,thensource ~/.bashrc
done.