VIM 的 set laststatus 配置项
时间: 2024-05-11 12:14:38 浏览: 3
set laststatus 配置项是用来设置 Vim 状态栏的显示方式的。状态栏可以显示当前文件的信息,如文件名、行号、列数等,也可以显示当前模式,如插入模式、命令模式等。
set laststatus 的取值有三种:
- 0 表示不显示状态栏;
- 1 表示在打开多个窗口时显示状态栏,否则不显示;
- 2 表示始终显示状态栏。
默认情况下,Vim 设置为显示状态栏。可以通过在 .vimrc 文件中添加以下代码来修改默认设置:
```
set laststatus=0 " 不显示状态栏
set laststatus=1 " 仅在打开多个窗口时显示状态栏
set laststatus=2 " 始终显示状态栏
```
需要注意的是,如果在 Vim 中使用了多个窗口,即使用了 split、vsplit 命令分割窗口,那么无论设置为 1 还是 2 都会显示状态栏。
相关问题
VIM vim set laststatus
The "laststatus" option in Vim controls whether the status line is displayed when there is only one window open. The possible values for this option are:
0: The status line is never shown.
1: The status line is shown only if there are at least two windows open.
2: The status line is always shown, even if there is only one window open.
To set the "laststatus" option to 2, you can use the following command in Vim:
:set laststatus=2
This will make the status line always visible, even if you only have one window open. You can change the value to 1 or 0 depending on your preference.
vim配置set nu
如果要在vim中配置set nu,有两种方法可以实现。一种是在vim模式中直接输入命令:set nu,这样可以在每一行前显示行号。另一种是在vimrc文件中输入该指令,编辑vimrc文件可以永久设定指令。在vimrc文件中输入set nu,并保存退出后,再次打开文件时,行号会自动显示。请注意,在进行编辑前,为了防止对文件造成不可逆的改变,请先备份vimrc文件。在Centos7最新版本中,默认已经安装了vim,可以通过执行命令rpm -qa|grep vim来检查是否已安装。