refactor(ide): use auto-session instead of Obsession.vim
This commit is contained in:
@@ -16,6 +16,25 @@ return {
|
||||
end,
|
||||
},
|
||||
|
||||
-- Session restore, enabled automatically in git repos
|
||||
{
|
||||
"auto-session",
|
||||
lazy = not require("dot013.utils").is_in_cwd(".git"),
|
||||
cmd = {
|
||||
"SessionSave",
|
||||
"SessionRestore",
|
||||
"SessionDelete",
|
||||
"SessionDisableAutoSave",
|
||||
"SessionToggleSave",
|
||||
"SessionPurgeOrphaned",
|
||||
"SessionSearch",
|
||||
"Auutosession",
|
||||
},
|
||||
after = function()
|
||||
require("auto-session").setup()
|
||||
end,
|
||||
},
|
||||
|
||||
-- Completion
|
||||
{
|
||||
"blink-cmp",
|
||||
@@ -89,9 +108,6 @@ return {
|
||||
ft = { "sh" },
|
||||
},
|
||||
|
||||
-- Session restore
|
||||
{
|
||||
"vim-obsession",
|
||||
cmd = "Obsess",
|
||||
},
|
||||
}
|
||||
|
||||
23
lua/dot013/utils.lua
Normal file
23
lua/dot013/utils.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local M = {}
|
||||
|
||||
M.is_in_cwd = function(name)
|
||||
local cwd = vim.fn.getcwd()
|
||||
local cwdContent = vim.split(vim.fn.glob(cwd .. "/*"), "\n", { trimempty = true })
|
||||
local hiddenCwdContent = vim.split(vim.fn.glob(cwd .. "/.*"), "\n", { trimempty = true })
|
||||
|
||||
for _, f in pairs(hiddenCwdContent) do
|
||||
table.insert(cwdContent, f)
|
||||
end
|
||||
|
||||
local fullName = cwd .. "/" .. name
|
||||
|
||||
for _, f in pairs(cwdContent) do
|
||||
if f == fullName then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user