summaryrefslogtreecommitdiff
path: root/fnl/plugins/editor/persistence.fnl
blob: 492ef0dc04bbbbe333420a5a5542c54455853ac4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
;; 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>
         :desc "Restore last session"}
        {1 :<leader>si
         2 :<cmd>IgnoreSession<cr>
         :desc "Ignore current session"}]
 :opts {:options [:buffers :curdir :tabpages :winsize :help]}}