Home > System Tutorial > LINUX > The master teaches you how to display the number of lines in vim editor

The master teaches you how to display the number of lines in vim editor

WBOY
Release: 2024-07-17 18:26:23
Original
479 people have browsed it

大神教你 vim 编辑器显示行数

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
Copy after login

Permanently effective plan;

# vi ~/.vimrc //或者直接输入添加下面命令

set nu

添加以后保存并退出!

这样就不用每次都输入命令查看行数了,以上2种方法都可以为vi设置行号,如果要取消的话,则输入

:set nonu
Copy after login

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
Copy after login

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!

source:linuxprobe.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template