diff options
Diffstat (limited to 'fnl/plugins/editor/persistence.fnl')
-rw-r--r-- | fnl/plugins/editor/persistence.fnl | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fnl/plugins/editor/persistence.fnl b/fnl/plugins/editor/persistence.fnl index 0b4e7a8..492ef0d 100644 --- a/fnl/plugins/editor/persistence.fnl +++ b/fnl/plugins/editor/persistence.fnl @@ -1,7 +1,28 @@ ;; Session manager. +(local user-cmds [[:RestoreSession + (lambda [] + (let [persistence (require :persistence)] + (persistence.load))) + {:nargs 0}] + [:RestoreLastSession + (lambda [] + (let [persistence (require :persistence)] + (persistence.load {:last true}))) + {:nargs 0}] + [:IgnoreSession + (lambda [] + (let [persistence (require :persistence)] + (persistence.stop))) + {:nargs 0}]]) + +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-user-cmds user-cmds))) + {1 :folke/persistence.nvim :event :VeryLazy + : init :keys [{1 :<leader>sn 2 :<cmd>RestoreSession<cr> :desc "Restore session"} {1 :<leader>se 2 :<cmd>RestoreLastSession<cr> |