
vim显示行号
Vi is a popular text editor for Linux and BSD environment. It gives a lot of feature to the user. But its learning curve is a bit complex. Actually learning vim is complex but after learning, it is very comfortable to work with text files. Vi is used system administrator, users, developers. Developers uses vim too. Because vim has very good syntax highlighting and wide programming language, configuration file support. Vi has the ability to auto-complete too. But today we will look at how to show line numbers and make this configuration persistent.
Vi是用于Linux和BSD环境的流行文本编辑器。 它为用户提供了很多功能。 但是它的学习曲线有点复杂。 实际上,学习vim很复杂,但是学习后,使用文本文件非常舒适。 Vi是用于系统管理员,用户,开发人员。 开发人员也使用vim。 由于vim具有非常好的语法突出显示和广泛的编程语言,因此支持配置文件。 Vi也可以自动完成。 但是今天,我们将研究如何显示行号并使该配置持久化。
显示行号 (Show Line Numbers)
We open our test file named my.c like below.
我们如下打开名为my.c的测试文件。
$ vim my.c
显示行号 (Show Line Numbers)
Now we can set line number options. We will write following command in the normal mode. To switch normal mode press ESC . We will use set number
configuration command.
现在我们可以设置行号选项。 我们将在普通模式下编写以下命令。 要切换正常模式,请按ESC。 我们将使用set number
配置命令。
:set number

隐藏行号(Hide Line Numbers)
We can hide existing line numbers with the following command. We will use set nonumber
configuration command.
我们可以使用以下命令隐藏现有的行号。 我们将使用set nonumber
配置命令。
:set nonumber

使行号显示配置永久存在(Make Line Number Display Configuration Persistent)
Changing all time the line number settings is a tedious task. It can be made persistent the line number setting by changing user or global vim configuration.
始终更改行号设置是一项繁琐的任务。 可以通过更改用户或全局vim配置来使行号设置持久化。
$ echo "set number" >> .vimrc
永久不显示任何行号显示配置 (Make No Line Number Display Configuration Persistent)
Changing all time the line number settings is a tedious task. It can be made persistent the line number setting by changing user or global vim configuration.
始终更改行号设置是一项繁琐的任务。 可以通过更改用户或全局vim配置来使行号设置持久化。
$ echo "set nonumber" >> .vimrc
vim显示行号