feat: Add persistence
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
"mini.cursorword": { "branch": "main", "commit": "331bc17172e41343d39d91a4ab571d510766812e" },
|
||||
"mini.indentscope": { "branch": "main", "commit": "d3f955f09b1a05d25d5a7740338fba2baaee41a3" },
|
||||
"mini.move": { "branch": "main", "commit": "b9e452f9c83565a1520e14f7531632160f3b0170" },
|
||||
"mini.nvim": { "branch": "main", "commit": "1599a473aa6f5290a5d740b1144846e6f0c3963d" },
|
||||
"mini.nvim": { "branch": "main", "commit": "7c2caf0ae915d819f2f39467d6bb9313c2b3e90a" },
|
||||
"mini.pairs": { "branch": "main", "commit": "4a014143fcb4e9df26198ccb3ecff3b9e77a048c" },
|
||||
"mini.surround": { "branch": "main", "commit": "580e4cb98c5900d9fe743865fb5a5b2178b4ab18" },
|
||||
"mini.tabline": { "branch": "main", "commit": "7e8584a06b86902c64227e4abd0c39ae74061101" },
|
||||
@@ -31,6 +31,7 @@
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "85d1145ac71c1b8e1423862c78165a1f609faf60" },
|
||||
"nvim-treesitter": { "branch": "main", "commit": "4916d6592ede8c07973490d9322f187e07dfefac" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "dfbfaa967a6f7ec50789bead7ef87e336c1fa63c" },
|
||||
"persistence.nvim": { "branch": "main", "commit": "b20b2a7887bd39c1a356980b45e03250f3dce49c" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "74b06c6c75e4eeb3108ec01852001636d85a932b" },
|
||||
"render-markdown.nvim": { "branch": "main", "commit": "f422cb5c6855f150e2ddcfaf44e7157b98b34f6a" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "b25b749b9db64d375d782094e2b9dce53ad53a40" },
|
||||
|
||||
29
lua/plugins/persistence.lua
Normal file
29
lua/plugins/persistence.lua
Normal file
@@ -0,0 +1,29 @@
|
||||
return {
|
||||
{
|
||||
"folke/persistence.nvim",
|
||||
lazy = false,
|
||||
opts = {
|
||||
-- Options (default values are standard)
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("persistence").setup(opts)
|
||||
|
||||
-- Automatically restore session when opening Neovim without arguments
|
||||
vim.api.nvim_create_autocmd("VimEnter", {
|
||||
group = vim.api.nvim_create_augroup("PersistenceAutoLoad", { clear = true }),
|
||||
callback = function()
|
||||
-- Only autoload if Neovim was launched with no arguments
|
||||
if vim.fn.argc() == 0 then
|
||||
-- Pre-load session if it exists for the current directory
|
||||
require("persistence").load()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- Session keymaps
|
||||
vim.keymap.set("n", "<leader>qs", function() require("persistence").load() end, { desc = "Restore Session" })
|
||||
vim.keymap.set("n", "<leader>ql", function() require("persistence").load({ last = true }) end, { desc = "Restore Last Session" })
|
||||
vim.keymap.set("n", "<leader>qd", function() require("persistence").stop() end, { desc = "Stop Session Saving (For exit)" })
|
||||
end,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user