vim显示行号_Vi / Vim显示行号

vim显示行号

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
Show Line Numbers
Show Line Numbers
显示行号

隐藏行号(Hide Line Numbers)

We can hide existing line numbers with the following command. We will use set nonumber configuration command.

我们可以使用以下命令隐藏现有的行号。 我们将使用set nonumber配置命令。

:set nonumber
Hide Line Numbers
Hide Line Numbers
隐藏行号

使行号显示配置永久存在(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
LEARN MORE  Vim Syntax Highlighting How To Turn On , Off
了解更多Vim语法突出显示如何打开,关闭

翻译自: https://www.poftut.com/vi-vim-show-line-numbers/

vim显示行号

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值