Vim 中折叠和子折叠的不同颜色

发布于 2024-09-27 06:15:31 字数 133 浏览 0 评论 0原文

是否可以为折叠和子折叠设置不同的颜色集,例如:

  • 折叠级别 1 的灰色背景上的蓝色前景(默认)
  • 折叠级别 2 的深黄色背景上的黑色前景
  • 等...(尽管进一步向下似乎是有点过分)

Is it possible to have different set of colors for folds and subfolds, eg:

  • blue foreground on grey background for fold level 1 (default)
  • black foreground on dark yellow background for fold level 2
  • etc... (although going further down would seem a bit excessive)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

清风夜微凉 2024-10-04 06:15:31

这取决于您使用的是 Gui Vim 版本还是文本版本。
从我这边(文本版本)我已经在我的 .vimrc 中设置了

hi Folded ctermfg=Black
hi Folded ctermbg=DarkGrey

It depends if you are using Gui Vim version or text one.
From my side (text version) I have set that in my .vimrc

hi Folded ctermfg=Black
hi Folded ctermbg=DarkGrey
断桥再见 2024-10-04 06:15:31

来自 vim 文档:

COLORS                          *fold-colors*

The colors of a closed fold are set with the Folded group |hl-Folded|.  The
colors of the fold column are set with the FoldColumn group |hl-FoldColumn|.
Example to set the colors: >

        :highlight Folded guibg=grey guifg=blue
        :highlight FoldColumn guibg=darkgrey guifg=white

所以你不能轻易做到这一点。我能给你的最好的建议是设置状态栏以显示当前的折叠级别(如果可能)。

From vim documentation:

COLORS                          *fold-colors*

The colors of a closed fold are set with the Folded group |hl-Folded|.  The
colors of the fold column are set with the FoldColumn group |hl-FoldColumn|.
Example to set the colors: >

        :highlight Folded guibg=grey guifg=blue
        :highlight FoldColumn guibg=darkgrey guifg=white

so you cannot easily do this. The best piece of advice I could give you is to set statusbar to display the current fold level if possible.

始于初秋 2024-10-04 06:15:31

我有一个 Vim c 代码的简单补丁,可以让您轻松地进行设置。如果您想要该补丁来重新编译 Vim,请告诉我,或者如果您使用的是 Windows,我可以向您发送 Vim 7.2 的修补可执行文件。

I have a simple patch to the Vim c code that lets you set this up pretty easily. Let me know if you want the patch to recompile Vim, or if you're on Windows I can send you a patched executable for Vim 7.2.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文