Often when using vi to edit a file under Linux, basically no line number is displayed. Sometimes the file must be transferred to the local computer and modified with a powerful editor. Here I will share a small command. When you edit a file When configuring the file, enter the following command to display the number of lines. Applicable to any linux open source system.
set nu set number
Permanently effective plan;
# vi ~/.vimrc //或者直接输入添加下面命令 set nu 添加以后保存并退出! 这样就不用每次都输入命令查看行数了,以上2种方法都可以为vi设置行号,如果要取消的话,则输入 :set nonu
And delete set nu in vi ~/.vimrc file.
The setting of the line number is the vi environment setting and will not affect the content of the text. Be sure to remember not to type in the terminal, but when entering to edit text, for example:
# vi /usr/local/nginx/nginx.cnf
After execution, enter Shift+: and then enter the command parameters mentioned above to display the line number.
The above is the detailed content of The master teaches you how to display the number of lines in vim editor. For more information, please follow other related articles on the PHP Chinese website!