英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论