From d474c779523c512e3bc91bc5ce7bc87cafc6372b Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Sat, 23 Sep 2023 22:05:37 +0200 Subject: Move user and auto cmds to plugins --- fnl/plugins/editor/persistence.fnl | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'fnl/plugins/editor/persistence.fnl') 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 :sn 2 :RestoreSession :desc "Restore session"} {1 :se 2 :RestoreLastSession -- cgit v1.2.3-70-g09d2