是否有可能让Vim中的statusbar显示autoindent是否打开?

我一直在谷歌搜索它,并在Vim主页中阅读以下内容:http://vimdoc.sourceforge.net/htmldoc/options.html#%27statusline%27
看来这是不可能的。

有帮助吗?

解决方案

您可以使用 %{...} 评估状态行中的自定义表达式

set statusline=%{&autoindent?'autoindent':'noautoindent'}

我没有在表达式中放置空格,但如果你想要它们,你可以使用 \ 就像逃避他们一样

set statusline=%{&autoindent\ ?\ 'autoindent'\ :\ 'noautoindent'}

但是,将其放入函数并调用该函数可能会更容易。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top