如何在neovim中更改波浪线或EndOfBuffer的颜色

huangapple go评论61阅读模式
英文:

How to change the color of the tilde or EndOfBuffer in neovim

问题

我试图更改neovim中缓冲行末尾的'~'的颜色。在我尝试了所有可能的方法后,我找到了解决方案。

(发布在答案中)。

英文:

I'm trying to change the color of the '~' at the end of buffer line in neovim. I couldn't find any answer until I tested all I could and found a solution.

(Posting in answer).

答案1

得分: 1

如果您想要覆盖主题并设置文件末尾的波浪符(EndOfBuffer)的颜色,您需要在您的lua neovim theme.lua文件或您用于配置它的任何文件中添加以下命令:

vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = "#101e2c" } ) -- 覆盖文件末尾的 `~` 字符颜色

您可以类似地对背景窗口和行号进行类似的操作,这里是示例,以防您感兴趣:

-- vim.api.nvim_set_hl(0, "LineNr", { fg = "#716682" }) -- 使用这个与kanagawa一起,覆盖行号颜色
vim.api.nvim_set_hl(0, "Normal", { bg = "#101e2c" }) -- 使用这个与night-owl一起,覆盖窗口的背景

vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = "#101e2c" } ) -- 覆盖文件末尾的 `~` 字符颜色

(Note: This is a translation of the provided code and instructions without additional content.)

英文:

If you want to override the theme and set the color of the '~' at the end of file (EndOfBuffer), you have to add this command in your lua neovim theme.lua or which ever file you use to have it configured.

vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = "#101e2c"} ) -- overrides `~` character at the end of buffer

You can do similar things for the background window and the number line, here added in case you are curious:

-- vim.api.nvim_set_hl(0, "LineNr", { fg = "#716682" }) -- use this w/ kanagawa, overrides number line color
vim.api.nvim_set_hl(0, "Normal", { bg = "#101e2c"}) -- use this for night-owl, overrides background of windows

vim.api.nvim_set_hl(0, "EndOfBuffer", { fg = "#101e2c"} ) -- overrides `~` character at the end of buffer

huangapple
  • 本文由 发表于 2023年5月21日 05:09:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/76297356.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定