Implement kind highlights (#584)

* Implement kind highlights

* Fix link
This commit is contained in:
hrsh7th
2021-11-27 19:20:44 +09:00
committed by GitHub
parent 7b744e0589
commit 593a6345de
3 changed files with 31 additions and 1 deletions

View File

@@ -5,6 +5,7 @@ vim.g.loaded_cmp = true
local api = require "cmp.utils.api"
local misc = require('cmp.utils.misc')
local types = require('cmp.types')
local config = require('cmp.config')
local highlight = require('cmp.utils.highlight')
@@ -78,6 +79,11 @@ misc.set(_G, { 'cmp', 'plugin', 'colorscheme' }, function()
guibg = 'NONE',
ctermbg = 'NONE',
})
for name in pairs(types.lsp.CompletionItemKind) do
if type(name) == 'string' then
vim.cmd(([[highlight! default link CmpItemKind%sDefault CmpItemKindDefault]]):format(name))
end
end
highlight.inherit('CmpItemMenuDefault', 'Pmenu', {
guibg = 'NONE',
ctermbg = 'NONE',
@@ -104,6 +110,14 @@ end
if vim.fn.hlexists('CmpItemKind') ~= 1 then
vim.cmd [[highlight! default link CmpItemKind CmpItemKindDefault]]
end
for name in pairs(types.lsp.CompletionItemKind) do
if type(name) == 'string' then
local hi = ('CmpItemKind%s'):format(name)
if vim.fn.hlexists(hi) ~= 1 then
vim.cmd(([[highlight! default link %s %sDefault]]):format(hi, hi))
end
end
end
if vim.fn.hlexists('CmpItemMenu') ~= 1 then
vim.cmd [[highlight! default link CmpItemMenu CmpItemMenuDefault]]