vim行号-默认情况下如何启用它们?

本文翻译自:vim line numbers - how to have them on by default?

我可以从正在编辑的文件中:set number ,但是默认情况下如何使它们始终处于打开状态?


#1楼

参考:https://stackoom.com/question/H6M2/vim行号-默认情况下如何启用它们


#2楼

Add set number to your .vimrc file in your home directory. set number添加到主目录中的.vimrc文件中。
If the .vimrc file is not in your home directory create one with vim .vimrc and add the commands you want at open. 如果.vimrc文件不在您的主目录中,请使用vim .vimrc创建一个文件,并在打开时添加所需的命令。

Here's a site that explains the vimrc and how to use it. 这是一个解释vimrc以及如何使用它的网站。


#3楼

To change the default setting to display line numbers in vi/vim: 要更改默认设置以在vi / vim中显示行号:

vi ~/.vimrc

then add the following line to the file: 然后将以下行添加到文件中:

set number

Either we can source ~/.vimrc or save and quit by :wq , now future vi/vim sessions will have numbering :) 我们可以获取source ~/.vimrc或通过:wq保存并退出,现在以后的vi / vim会话将具有编号:)


#4楼

在主目录中,您将找到一个名为“ .vimrc”的文件,在该文件中添加此代码“ set nu ”,然后保存并退出并打开新的vi文件,并在其上找到行号。


#5楼

Terminal > su > password > vim /etc/vimrc 终端> su > password > vim /etc/vimrc

Click here and edit as in line number (13): 单击此处,然后按行号(13)进行编辑:

set nu

单击此处,然后编辑为“行号(13)”


#6楼

I'm using Debian 7 64-bit. 我正在使用Debian 7 64位。

I didn't have a .vimrc file in my home folder. 我的主文件夹中没有.vimrc文件。 I created one and was able to set user defaults for vim. 我创建了一个,并且能够为vim设置用户默认值。

However, for Debian 7, another way is to edit /etc/vim/vimrc 但是,对于Debian 7,另一种方法是编辑/ etc / vim / vimrc

Here is a comment block in that file: 这是该文件中的注释块:

" All system-wide defaults are set in $VIMRUNTIME/debian.vim (usually just
" /usr/share/vim/vimcurrent/debian.vim) and sourced by the call to :runtime
" you can find below.  If you wish to change any of those settings, you should
" do it in this file (/etc/vim/vimrc), since debian.vim will be overwritten
" everytime an upgrade of the vim packages is performed.  It is recommended to
" make changes after sourcing debian.vim since it alters the value of the
" 'compatible' option.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值