Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UfoFoldedFg and UfoFoldedBg color setting not working #220

Closed
chunxuan-hs opened this issue May 13, 2024 · 1 comment
Closed

UfoFoldedFg and UfoFoldedBg color setting not working #220

chunxuan-hs opened this issue May 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@chunxuan-hs
Copy link

Neovim version (nvim -v | head -n1)

nvim 0.9.4

Operating system/version

macos 13

How to reproduce the issue

Could not change the color of highlight group.

Codes to change the color

hi UfoFoldedBg guibg=#f43753

Basic config

lua << EOF
vim.o.foldcolumn = '1'
vim.o.foldlevel = 99 
vim.o.foldlevelstart = 99
vim.o.foldenable = true

require('ufo').setup({
  open_fold_hl_timeout = 0 
})

vim.keymap.set('n', 'zR', require('ufo').openAllFolds)
vim.keymap.set('n', 'zM', require('ufo').closeAllFolds)
-- vim.keymap.set('n', 'zr', require('ufo').openFoldsExceptKinds)
-- vim.keymap.set('n', 'zm', require('ufo').closeFoldsWith)
EOF

Expected behavior

The color do not change:
Screenshot 2024-05-13 at 11 13 15

However, it seems the UfoFoldedBg has been set correctly.
Screenshot 2024-05-13 at 11 23 22

Actual behavior

Expect a different highligh color for the folded line.

Many thanks!

@chunxuan-hs chunxuan-hs added the bug Something isn't working label May 13, 2024
@kevinhwang91
Copy link
Owner

local ok, hl = pcall(api.nvim_get_hl_by_name, 'Folded', termguicolors)
if ok and hl.background then
if termguicolors then
cmd(('hi default UfoFoldedBg guibg=#%x'):format(hl.background))
else
cmd(('hi default UfoFoldedBg ctermbg=%d'):format(hl.background))
end
else
cmd('hi default link UfoFoldedBg Visual')
end
ok, hl = pcall(api.nvim_get_hl_by_name, 'Normal', termguicolors)
if ok and hl.foreground then
if termguicolors then
cmd(('hi default UfoFoldedFg guifg=#%x'):format(hl.foreground))
else
cmd(('hi default UfoFoldedFg ctermfg=%d'):format(hl.foreground))
end
else
cmd('hi default UfoFoldedFg ctermfg=None guifg=None')
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants