refactor(config): nest integration toggles under integrations namespace
Problem: integration keys (`fugitive`, `neogit`, `gitsigns`, `committia`, `telescope`) live at the top level of `vim.g.diffs`, cluttering the config alongside unrelated options like `highlights` and `conflict`. Solution: move them under `vim.g.diffs.integrations.*`. Old top-level keys are migrated automatically with a `vim.deprecate` warning targeting v0.3.2. `compute_filetypes` and `plugin/diffs.lua` fall back to legacy keys for pre-`init()` callers.
This commit is contained in:
parent
83c17aca67
commit
1b4d933148
4 changed files with 129 additions and 67 deletions
|
|
@ -5,7 +5,17 @@ vim.g.loaded_diffs = 1
|
|||
|
||||
require('diffs.commands').setup()
|
||||
|
||||
local gs_cfg = (vim.g.diffs or {}).gitsigns
|
||||
local function get_raw_integration(key)
|
||||
local user = vim.g.diffs or {}
|
||||
local intg = user.integrations or {}
|
||||
local v = intg[key]
|
||||
if v ~= nil then
|
||||
return v
|
||||
end
|
||||
return user[key]
|
||||
end
|
||||
|
||||
local gs_cfg = get_raw_integration('gitsigns')
|
||||
if gs_cfg == true or type(gs_cfg) == 'table' then
|
||||
if not require('diffs.gitsigns').setup() then
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
|
|
@ -18,7 +28,7 @@ if gs_cfg == true or type(gs_cfg) == 'table' then
|
|||
end
|
||||
end
|
||||
|
||||
local tel_cfg = (vim.g.diffs or {}).telescope
|
||||
local tel_cfg = get_raw_integration('telescope')
|
||||
if tel_cfg == true or type(tel_cfg) == 'table' then
|
||||
vim.api.nvim_create_autocmd('User', {
|
||||
pattern = 'TelescopePreviewerLoaded',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue