Files
nvim-cmp/lua/cmp/utils/highlight.lua
hrsh7th 5054c14490 dev (#956)
* Adjust empty line count

* Implement vim.api.nvim_create_autocmd (#844)

* Implement vim.api.nvim_create_autocmd

* Only use vim.api.nvim_create_autocmd on nighly

* Cleanup

* cleanup

* Rename autos.lua to autocmds.lua

* Fix forgot to rename autos to autocmds

* Remove legacy autocmd

* Add descriptions on autocmds

* Update descriptions on autocmds

* Update CmpStatus command to lua API (#922)

Signed-off-by: Micah Halter <micah@balena.io>

* Move highlights to nvim_set_hl lua API (#925)

Signed-off-by: Micah Halter <micah@balena.io>

* Add default to highlight

* Refactor autocmds

* fmt

* Improve performance

* Fix bug

* Improve matching logic
Fixes https://github.com/hrsh7th/nvim-cmp/discussions/954

* Fix format

* Improve performance
Fix #825

* Fix cmdline redraw bug

* Fix event

Co-authored-by: hrsh7th <>
Co-authored-by: zer09 <zer09@users.noreply.github.com>
Co-authored-by: Micah Halter <micah@mehalter.com>
2022-05-04 01:47:01 +09:00

31 lines
564 B
Lua

local highlight = {}
highlight.keys = {
'fg',
'bg',
'bold',
'italic',
'reverse',
'standout',
'underline',
'undercurl',
'strikethrough',
}
highlight.inherit = function(name, source, settings)
for _, key in ipairs(highlight.keys) do
if not settings[key] then
local v = vim.fn.synIDattr(vim.fn.hlID(source), key)
if key ~= 'fg' and key ~= 'bg' then
v = v == 1
end
if v then
settings[key] = v == '' and 'NONE' or v
end
end
end
vim.api.nvim_set_hl(0, name, settings)
end
return highlight