【问题标题】:vim: change the status line color in insert modevim:在插入模式下更改状态行颜色
【发布时间】:2012-06-21 21:38:40
【问题描述】:

我发现这个 sn-p 可以在我进入插入模式时更改状态行颜色:

" first, enable status line always
set laststatus=2

" now set it up to change the status line based on mode
if version >= 700
  au InsertEnter * hi StatusLine term=reverse ctermbg=5 gui=undercurl guisp=Magenta
  au InsertLeave * hi StatusLine term=reverse ctermfg=0 ctermbg=2 gui=bold,reverse
endif

现在,当我进入插入模式时,状态行变为紫色,但我想将其更改为红色。我把 Magenta 改成了 Red,但它不起作用..

【问题讨论】:

    标签: vim


    【解决方案1】:

    如果您使用:help,您可以找出每个属性的含义。

    guisp 用于突出显示的“特殊”颜色。在这种情况下,它是底卷曲效果的颜色。听起来您想更改实际的突出显示颜色,所以试试这个:

    au InsertEnter * hi StatusLine term=reverse ctermbg=5 gui=undercurl guisp=Magenta guibg=Red
    

    事实上,如果你只使用 GUI Vim,你不需要任何终端选项:

    au InsertEnter * hi StatusLine guibg=Red
    au InsertLeave * hi StatusLine guibg=#ccdc90
    

    对于InsertLeave,我只是以我正常的StatusLine 颜色为例。您应该可以在您的配色方案文件中找到它。

    顺便说一句,guibg 实际上会影响文本颜色,而guifg 会影响线条颜色...

    【讨论】:

      【解决方案2】:

      我没有看到任何提及您是使用 gui 版本的 Vim,还是只是在终端中使用 Vim。

      如果您在终端中,则需要将 "ctermbg=5" 更改为 "ctermbg=red"。在这种情况下,"5" 转换为 "DarkMagenta"。 Vim 将接受这些属性的数字或颜色名称。

      更多信息可以在 Vim 语法文档中Highlight Command 下的第 2 节和第 3 节中找到。

      【讨论】:

        【解决方案3】:

        很好的解决方案:Powerline plugin

        【讨论】:

        • 看起来很棒,但在 Debian Squeeze 下安装说明失败:-(
        猜你喜欢
        • 2011-11-28
        • 1970-01-01
        • 2020-08-18
        • 1970-01-01
        • 2020-02-08
        • 1970-01-01
        • 1970-01-01
        • 2018-06-17
        • 1970-01-01
        相关资源
        最近更新 更多