refactor(config): nest integration toggles under integrations namespace (#174)
## Problem
Integration keys (`fugitive`, `neogit`, `gitsigns`, `committia`,
`telescope`)
live at the top level of `vim.g.diffs`, cluttering the config namespace.
## Solution
Move them under `vim.g.diffs.integrations.*`. Old top-level keys still
work but
emit `vim.deprecate` targeting v0.3.2. `compute_filetypes` and
`plugin/diffs.lua`
fall back to legacy keys for pre-`init()` callers.
Also includes `83c17ac` which fixes an invalid hex hash in the combined
diff test
fixture.
This commit is contained in:
parent
823743192a
commit
a880261988
4 changed files with 151 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