refactor: rename vim.g.cp_config to vim.g.cp
This commit is contained in:
parent
b2c7f16890
commit
a54a06f939
2 changed files with 12 additions and 8 deletions
|
|
@ -17,7 +17,11 @@ local function ensure_initialized()
|
|||
if initialized then
|
||||
return
|
||||
end
|
||||
local user_config = vim.g.cp_config or {}
|
||||
if vim.g.cp_config then
|
||||
vim.deprecate('vim.g.cp_config', 'vim.g.cp', 'v0.7.6', 'cp.nvim', false)
|
||||
vim.g.cp = vim.g.cp or vim.g.cp_config
|
||||
end
|
||||
local user_config = vim.g.cp or {}
|
||||
local config = config_module.setup(user_config)
|
||||
config_module.set_current_config(config)
|
||||
initialized = true
|
||||
|
|
@ -34,12 +38,12 @@ function M.is_initialized()
|
|||
return initialized
|
||||
end
|
||||
|
||||
---@deprecated Use `vim.g.cp_config` instead
|
||||
---@deprecated Use `vim.g.cp` instead
|
||||
function M.setup(user_config)
|
||||
vim.deprecate('require("cp").setup()', 'vim.g.cp_config', 'v0.1.0', 'cp.nvim', false)
|
||||
vim.deprecate('require("cp").setup()', 'vim.g.cp', 'v0.1.0', 'cp.nvim', false)
|
||||
|
||||
if user_config then
|
||||
vim.g.cp_config = vim.tbl_deep_extend('force', vim.g.cp_config or {}, user_config)
|
||||
vim.g.cp = vim.tbl_deep_extend('force', vim.g.cp or {}, user_config)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue