refactor: clean up `mks` command

main
olimorris 2023-06-02 10:22:04 +01:00
parent b42a8a87da
commit 2e6946c1ad
1 changed files with 2 additions and 9 deletions

View File

@ -53,7 +53,7 @@ function M.get_branch()
.. branch .. branch
.. ".vim" .. ".vim"
-- Check if session exists for the current branch, otherwise use default_branch -- Try to load the session for the current branch and if not, use the value of default_branch
if vim.fn.filereadable(branch_session) ~= 0 then if vim.fn.filereadable(branch_session) ~= 0 then
return branch return branch
else else
@ -157,15 +157,8 @@ function M.save(opt)
end end
vim.api.nvim_exec_autocmds("User", { pattern = "PersistedSavePre" }) vim.api.nvim_exec_autocmds("User", { pattern = "PersistedSavePre" })
vim.cmd("mks! " .. e(vim.g.persisted_branch_session or vim.g.persisting_session or get_current()))
if vim.g.persisted_branch_session then
vim.cmd("mks! " .. e(vim.g.persisted_branch_session))
else
vim.cmd("mks! " .. e(vim.g.persisting_session or get_current()))
end
vim.g.persisting = true vim.g.persisting = true
vim.api.nvim_exec_autocmds("User", { pattern = "PersistedSavePost" }) vim.api.nvim_exec_autocmds("User", { pattern = "PersistedSavePost" })
end end