specify conditions to re-enable diagnostics after git conflict

This commit is contained in:
Baipyrus 2024-10-17 10:55:18 +02:00
parent 5febea0f8a
commit f19ae0487b

View File

@ -24,9 +24,10 @@ return {
local beginning = vim.fn.match(lines, vim.g.conflict_marker_begin) local beginning = vim.fn.match(lines, vim.g.conflict_marker_begin)
local ending = vim.fn.match(lines, vim.g.conflict_marker_end) local ending = vim.fn.match(lines, vim.g.conflict_marker_end)
local enabled = vim.diagnostic.is_enabled() local enabled = vim.diagnostic.is_enabled()
if (beginning > -1 or ending > -1) and enabled then local conflict = beginning > -1 or ending > -1
if conflict and enabled then
vim.diagnostic.enable(false) vim.diagnostic.enable(false)
elseif not enabled then elseif not conflict and not enabled then
vim.diagnostic.enable(true) vim.diagnostic.enable(true)
end end
end end