Compare commits
1 commit
doc/merge-
...
feat/highl
| Author | SHA1 | Date | |
|---|---|---|---|
| a9eea9c157 |
2 changed files with 26 additions and 0 deletions
|
|
@ -74,6 +74,7 @@ Configuration is done via `vim.g.diffs`. Set this before the plugin loads:
|
||||||
algorithm = 'default',
|
algorithm = 'default',
|
||||||
max_lines = 500,
|
max_lines = 500,
|
||||||
},
|
},
|
||||||
|
overrides = {},
|
||||||
},
|
},
|
||||||
fugitive = {
|
fugitive = {
|
||||||
horizontal = 'du',
|
horizontal = 'du',
|
||||||
|
|
@ -141,6 +142,13 @@ Configuration is done via `vim.g.diffs`. Set this before the plugin loads:
|
||||||
Character-level (intra-line) diff highlighting.
|
Character-level (intra-line) diff highlighting.
|
||||||
See |diffs.IntraConfig| for fields.
|
See |diffs.IntraConfig| for fields.
|
||||||
|
|
||||||
|
{overrides} (table, default: {})
|
||||||
|
Map of highlight group names to highlight
|
||||||
|
definitions (see |nvim_set_hl()|). Applied
|
||||||
|
after all computed groups without `default`,
|
||||||
|
so overrides always win over both computed
|
||||||
|
defaults and colorscheme definitions.
|
||||||
|
|
||||||
*diffs.ContextConfig*
|
*diffs.ContextConfig*
|
||||||
Context config fields: ~
|
Context config fields: ~
|
||||||
{enabled} (boolean, default: true)
|
{enabled} (boolean, default: true)
|
||||||
|
|
@ -469,6 +477,16 @@ To customize these in your colorscheme: >lua
|
||||||
vim.api.nvim_set_hl(0, 'DiffsAdd', { bg = '#2e4a3a' })
|
vim.api.nvim_set_hl(0, 'DiffsAdd', { bg = '#2e4a3a' })
|
||||||
vim.api.nvim_set_hl(0, 'DiffsDiffDelete', { link = 'DiffDelete' })
|
vim.api.nvim_set_hl(0, 'DiffsDiffDelete', { link = 'DiffDelete' })
|
||||||
<
|
<
|
||||||
|
Or via `highlights.overrides` in config: >lua
|
||||||
|
vim.g.diffs = {
|
||||||
|
highlights = {
|
||||||
|
overrides = {
|
||||||
|
DiffsAdd = { bg = '#2e4a3a' },
|
||||||
|
DiffsDiffDelete = { link = 'DiffDelete' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
<
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
HEALTH CHECK *diffs-health*
|
HEALTH CHECK *diffs-health*
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
---@field background boolean
|
---@field background boolean
|
||||||
---@field gutter boolean
|
---@field gutter boolean
|
||||||
---@field blend_alpha? number
|
---@field blend_alpha? number
|
||||||
|
---@field overrides? table<string, vim.api.keyset.highlight>
|
||||||
---@field context diffs.ContextConfig
|
---@field context diffs.ContextConfig
|
||||||
---@field treesitter diffs.TreesitterConfig
|
---@field treesitter diffs.TreesitterConfig
|
||||||
---@field vim diffs.VimConfig
|
---@field vim diffs.VimConfig
|
||||||
|
|
@ -229,6 +230,12 @@ local function compute_highlight_groups()
|
||||||
)
|
)
|
||||||
vim.api.nvim_set_hl(0, 'DiffsDiffChange', { default = true, bg = diff_change.bg })
|
vim.api.nvim_set_hl(0, 'DiffsDiffChange', { default = true, bg = diff_change.bg })
|
||||||
vim.api.nvim_set_hl(0, 'DiffsDiffText', { default = true, bg = diff_text.bg })
|
vim.api.nvim_set_hl(0, 'DiffsDiffText', { default = true, bg = diff_text.bg })
|
||||||
|
|
||||||
|
if config.highlights.overrides then
|
||||||
|
for group, hl in pairs(config.highlights.overrides) do
|
||||||
|
vim.api.nvim_set_hl(0, group, hl)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function init()
|
local function init()
|
||||||
|
|
@ -251,6 +258,7 @@ local function init()
|
||||||
['highlights.background'] = { opts.highlights.background, 'boolean', true },
|
['highlights.background'] = { opts.highlights.background, 'boolean', true },
|
||||||
['highlights.gutter'] = { opts.highlights.gutter, 'boolean', true },
|
['highlights.gutter'] = { opts.highlights.gutter, 'boolean', true },
|
||||||
['highlights.blend_alpha'] = { opts.highlights.blend_alpha, 'number', true },
|
['highlights.blend_alpha'] = { opts.highlights.blend_alpha, 'number', true },
|
||||||
|
['highlights.overrides'] = { opts.highlights.overrides, 'table', true },
|
||||||
['highlights.context'] = { opts.highlights.context, 'table', true },
|
['highlights.context'] = { opts.highlights.context, 'table', true },
|
||||||
['highlights.treesitter'] = { opts.highlights.treesitter, 'table', true },
|
['highlights.treesitter'] = { opts.highlights.treesitter, 'table', true },
|
||||||
['highlights.vim'] = { opts.highlights.vim, 'table', true },
|
['highlights.vim'] = { opts.highlights.vim, 'table', true },
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue