Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How vim does not display Line number in linux

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of how vim does not display line numbers in linux, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value, I believe you will have something to gain after reading this linux article on how vim does not display line numbers, let's take a look.

In linux, vim uses ": set nonu" so that the line number is not displayed during editing; the purpose of this command is to cancel the line number, or you can use the ": setnu" command to make the line number appear again. If the configuration file ".vimrc" exists, you can add a line "set nonu" to the file so that the file does not display line numbers each time.

The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

Why doesn't vim display the line number in linux?

: setnu displays the line number

: setnonu cancels line number

In the process of editing with Vim, you often encounter situations where you need to operate on several consecutive lines at the same time, which is very convenient if there is a line number prompt for each line.

Enter ": set nu" in command mode to display the line number of each line, as shown in the figure.

If you want to cancel the line number, type ": set nonu" again.

If you want the line number to display by default every time you open a file, you can edit the configuration file for Vim. Each time you open a file using Vim, Vim reads the .vimrc file in the host directory of the currently logged-in user (where the user profile is located), which makes some default configuration settings for Vim.

If the .vimrc file exists, read the settings for Vim in it first; otherwise, take the default configuration. By default, this file does not exist in the user's host directory and needs to be manually created in the current user's host directory. For example, "vim~/.vimrc", "~" represents the host directory, and the root host directory is / root/,. The ordinary user's host directory is stored in the / home/ directory. You can directly use Vim editing to generate this file, add a line "set nu" to the file, save and exit, as shown in the figure.

This is the end of the article on "how vim does not display line numbers in linux". Thank you for reading! I believe you all have a certain understanding of the knowledge of "how vim does not display line numbers in linux". If you want to learn more, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 280

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report