diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 580146e..4e6ba60 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -36,6 +36,7 @@ with final.pkgs.lib; let # Util plenary-nvim nui-nvim + persistence-nvim # Colorscheme rose-pine diff --git a/nvim/lua/plugins/ui/alpha-nvim.lua b/nvim/lua/plugins/ui/alpha-nvim.lua index 209337d..8a6604f 100644 --- a/nvim/lua/plugins/ui/alpha-nvim.lua +++ b/nvim/lua/plugins/ui/alpha-nvim.lua @@ -42,7 +42,7 @@ return { button( 's', ' Restore session', - 'lua require("persistence").load()' + 'lua require("lz.n").trigger_load("persistence.nvim"); require("persistence").load()' ), button('q', ' Quit', 'qa'), diff --git a/nvim/lua/plugins/util/init.lua b/nvim/lua/plugins/util/init.lua index ce91954..892751c 100644 --- a/nvim/lua/plugins/util/init.lua +++ b/nvim/lua/plugins/util/init.lua @@ -2,5 +2,6 @@ local req = require('lib.marleyvim').localRequire('plugins.util') return { req('nui-nvim'), + req('persistance-nvim'), req('plenary'), } diff --git a/nvim/lua/plugins/util/persistance-nvim.lua b/nvim/lua/plugins/util/persistance-nvim.lua new file mode 100644 index 0000000..e54f273 --- /dev/null +++ b/nvim/lua/plugins/util/persistance-nvim.lua @@ -0,0 +1,37 @@ +return { + 'persistence.nvim', + event = 'BufReadPre', + keys = { + { + 'qs', + function() + require('persistence').load() + end, + desc = 'Restore session', + }, + { + 'qS', + function() + require('persistence').select() + end, + desc = 'Select session', + }, + { + 'ql', + function() + require('persistence').load({ last = true }) + end, + desc = 'Restore last session', + }, + { + 'qd', + function() + require('persistence').stop() + end, + desc = "Don't save current session", + }, + }, + after = function() + require('persistence').setup({}) + end, +}