fix: clear diagnostics
parent
26d82d6876
commit
226db9219f
|
|
@ -28,16 +28,7 @@ M.options = {}
|
||||||
|
|
||||||
function M.setup(opts)
|
function M.setup(opts)
|
||||||
M.options = vim.tbl_deep_extend("force", {}, defaults, opts or {})
|
M.options = vim.tbl_deep_extend("force", {}, defaults, opts or {})
|
||||||
if M.options.options then
|
vim.fn.mkdir(M.options.save_dir, "p")
|
||||||
vim.cmd(
|
|
||||||
'echohl WarningMsg | echom "Persisted.nvim: The `option` config variable has now been replaced by vim.o.sessionoptions" | echohl NONE'
|
|
||||||
)
|
|
||||||
vim.cmd('echohl WarningMsg | echom "Persisted.nvim: Please set vim.o.sessionoptions accordingly" | echohl NONE')
|
|
||||||
end
|
|
||||||
-- if M.options.dir then
|
|
||||||
-- vim.cmd('echohl WarningMsg | echom "Persisted.nvim: The `dir` config option has now been replaced by `save_dir`. This will continue to be supported for the time being" | echohl NONE')
|
|
||||||
-- end
|
|
||||||
vim.fn.mkdir(M.options.dir or M.options.save_dir, "p")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ end
|
||||||
---Get the session that was saved last
|
---Get the session that was saved last
|
||||||
---@return string
|
---@return string
|
||||||
local function get_last()
|
local function get_last()
|
||||||
local sessions = vim.fn.glob(config.options.dir or config.options.save_dir .. "*.vim", true, true)
|
local sessions = vim.fn.glob(config.options.save_dir .. "*.vim", true, true)
|
||||||
table.sort(sessions, function(a, b)
|
table.sort(sessions, function(a, b)
|
||||||
return vim.loop.fs_stat(a).mtime.sec > vim.loop.fs_stat(b).mtime.sec
|
return vim.loop.fs_stat(a).mtime.sec > vim.loop.fs_stat(b).mtime.sec
|
||||||
end)
|
end)
|
||||||
|
|
@ -72,7 +72,7 @@ end
|
||||||
---@return string
|
---@return string
|
||||||
local function get_current()
|
local function get_current()
|
||||||
local name = vim.fn.getcwd():gsub(utils.get_dir_pattern(), "%%")
|
local name = vim.fn.getcwd():gsub(utils.get_dir_pattern(), "%%")
|
||||||
return (config.options.dir or config.options.save_dir) .. name .. M.get_branch() .. ".vim"
|
return (config.options.save_dir) .. name .. M.get_branch() .. ".vim"
|
||||||
end
|
end
|
||||||
|
|
||||||
---Setup the plugin based on the intersect of the default and the user's config
|
---Setup the plugin based on the intersect of the default and the user's config
|
||||||
|
|
@ -96,7 +96,7 @@ function M.setup(opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Load a session
|
---Load a session
|
||||||
---@param opt table
|
---@param opt? table
|
||||||
---@return nil
|
---@return nil
|
||||||
function M.load(opt)
|
function M.load(opt)
|
||||||
opt = opt or {}
|
opt = opt or {}
|
||||||
|
|
@ -110,8 +110,8 @@ function M.load(opt)
|
||||||
vim.g.persisting_session = session
|
vim.g.persisting_session = session
|
||||||
end
|
end
|
||||||
utils.load_session(session, config.options.before_source, config.options.after_source, config.options.silent)
|
utils.load_session(session, config.options.before_source, config.options.after_source, config.options.silent)
|
||||||
elseif type(config.options.on_autoload_no_session) == "function" then
|
elseif type(config.options.should_autosave) == "function" then
|
||||||
config.options.on_autoload_no_session()
|
config.options.should_autosave()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -183,7 +183,7 @@ function M.delete()
|
||||||
end
|
end
|
||||||
|
|
||||||
---Determines whether to load, start or stop a session
|
---Determines whether to load, start or stop a session
|
||||||
---@return function
|
---@return nil
|
||||||
function M.toggle()
|
function M.toggle()
|
||||||
if vim.g.persisting == nil then
|
if vim.g.persisting == nil then
|
||||||
return M.load()
|
return M.load()
|
||||||
|
|
@ -197,7 +197,7 @@ end
|
||||||
---List all of the sessions in the session directory
|
---List all of the sessions in the session directory
|
||||||
---@return table
|
---@return table
|
||||||
function M.list()
|
function M.list()
|
||||||
local save_dir = config.options.dir or config.options.save_dir
|
local save_dir = config.options.save_dir
|
||||||
local session_files = vim.fn.glob(save_dir .. "*.vim", true, true)
|
local session_files = vim.fn.glob(save_dir .. "*.vim", true, true)
|
||||||
local branch_separator = config.options.branch_separator
|
local branch_separator = config.options.branch_separator
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ function M.echoerr(msg, error)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Load the given session
|
---Load the given session
|
||||||
---@param session table
|
---@param session string
|
||||||
---@param before_callback function
|
---@param before_callback function
|
||||||
---@param after_callback function
|
---@param after_callback function
|
||||||
function M.load_session(session, before_callback, after_callback, silent)
|
function M.load_session(session, before_callback, after_callback, silent)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue