如果您不给:colorscheme一个参数,那么它将显示vim当前正在使用的colorcheme的名称。 vim中是否有类似的方法显示是否设置了选项,或者如果它不是 bool(boolean) 值,则显示选项的值是什么?例如,如果我想知道是否设置了autoindent或想知道textwidth的值,我将如何找到它?

最佳答案

使用:set命令。

  • :set autoindent?打印选项及其值(如果有)。 Vim切换选项( bool(boolean) 值,打开/关闭的选项),例如autoindent,都以no前缀,以表明它们已关闭,因此:set autoindent?将显示autoindentnoautoindent
  • :set autoindent打开autoindent
  • 此表单打开
  • 上的切换选项
  • 用于数字或字符串选项,它显示了选项的值,因此:set textwidth也将打印选项的值。对于数字或字符串选项,:set option:set option?等效。
  • :set autoindent!反转选项。 autoindent变为noautoindent
  • :set autoindent&autoindent还原为其默认值。
  • 使用:set option=value设置数字或字符串选项,例如set tabstop=3
  • 07-27 21:35