Vim行号 – 如何让他们在默认情况下?
我可以:set number从我正在编辑的文件中:set number ,但是如何让它们始终处于默认状态?
将set number添加到您的主目录中的.vimrc文件。
这是一个解释vimrc和如何使用它的网站。
要更改默认设置以在vi / vim中显示行号:
vi ~/.vimrc
然后将以下行添加到文件中:
set number
要么我们可以source ~/.vimrc或保存并退出:wq ,现在vim会话将编号:)
terminal> su > password > vim /etc/vimrc
点击此处并按照行号(13)进行编辑:
set nu

在主目录中你会发现一个名为“.vimrc”的文件,在这个文件中添加这个代码“ set nu ”并保存并退出并打开新的vi文件,你会发现在这个行号。
我正在使用Debian 7 64位。
我的主文件夹中没有.vimrc文件。 我创build了一个,并能够为vim设置用户默认值。
但是,对于Debian 7,另一种方法是编辑/ etc / vim / vimrc
这是该文件中的注释块:
" 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.