Add experimental.ghost_text.hl_group

This commit is contained in:
hrsh7th
2021-09-07 01:38:49 +09:00
parent abed04a6d4
commit b6b15d5f6e
2 changed files with 8 additions and 4 deletions

View File

@@ -36,7 +36,8 @@ core.menu = menu.new({
core.ghost_text = function(e)
vim.api.nvim_buf_clear_namespace(0, core.GHOST_TEXT_NS, 0, -1)
if not config.get().experimental.ghost_text then
local c = config.get().experimental.ghost_text
if not c then
return
end
@@ -58,7 +59,7 @@ core.ghost_text = function(e)
if #text > 0 then
vim.api.nvim_buf_set_extmark(ctx.bufnr, core.GHOST_TEXT_NS, ctx.cursor.row - 1, ctx.cursor.col - 1, {
right_gravity = false,
virt_text = { { text, 'Comment' } },
virt_text = { { text, c.hl_group } },
virt_text_pos = 'overlay',
virt_text_win_col = ctx.virtcol - 1,
priority = 1,

View File

@@ -49,7 +49,7 @@ cmp.PreselectMode.None = 'none'
---@field private revision number
---@field public preselect cmp.PreselectMode
---@field public completion cmp.CompletionConfig
---@field public documentation cmp.DocumentationConfig
---@field public documentation cmp.DocumentationConfig|"false"
---@field public confirmation cmp.ConfirmationConfig
---@field public sorting cmp.SortingConfig
---@field public formatting cmp.FormattingConfig
@@ -91,7 +91,10 @@ cmp.PreselectMode.None = 'none'
---@field on_confirm_done function(e: cmp.Entry)
---@class cmp.ExperimentalConfig
---@field public ghost_text boolean
---@field public ghost_text cmp.GhostTextConfig|"false"
---@class cmp.GhostTextConfig
---@field hl_group string
---@class cmp.SourceConfig
---@field public name string