如何从 ~/.config/nvim/init.vim 中持续更改 coc.nvim 颜色?

发布于 2025-01-13 03:40:00 字数 368 浏览 3 评论 0 原文

I understand that I can change my coc.nvim colours from inside neovim, but how do I do so permanently from the init.vim file (or otherwise), so that they're changed automatically every time I open the editor?

Default colours poor for legibility:

enter image description here

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

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

发布评论

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

评论(1

王权女流氓 2025-01-20 03:40:00

我的解决方案来自您分享的stackoverflow帖子这篇 vi stackexchange 帖子 并学习一些vimscript 艰难地学习 vimscript

init.vim 文件中,您可以编写以下内容:

func! s:my_colors_setup() abort
  highlight CocFloating ctermbg=color " For background color
  highlight CocErrorFloat ctermfg=color " For text color
endfunc

augroup colorscheme_coc_setup | au!
  au VimEnter * call s:my_colors_setup()
augroup END

这可以通过调用 突出显示 vim 启动时调用的函数上的命令

CocErrorFloat 更改错误弹出窗口的文本颜色,您还可以使用 CocWarningFloatCocInfoFloatCocHintFloat 更改警告、信息和提示代码> 分别。

My solution comes from the stackoverflow post you shared, this vi stackexchange post and learning a bit of vimscript with learning vimscript the hard way.

On your init.vim file you can write the following:

func! s:my_colors_setup() abort
  highlight CocFloating ctermbg=color " For background color
  highlight CocErrorFloat ctermfg=color " For text color
endfunc

augroup colorscheme_coc_setup | au!
  au VimEnter * call s:my_colors_setup()
augroup END

This works by calling the highlight command on a function that gets called when vim starts.

CocErrorFloat changes the text color for error popups, you could also change warnings, infos and hints with CocWarningFloat, CocInfoFloat and CocHintFloat respectively.

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