summaryrefslogtreecommitdiff
path: root/fnl/plugins/harpoon.fnl
blob: 62ebf177fcc1dcef130f07296643499ae16f789a (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
;; Harpoon files for navigation.

(local opts {:ui_max_width 64 :title " ⇁  "})

(local user-cmds [[:HarpoonAdd
                   (λ []
                     (let [harpoon (require :harpoon)]
                       (: (harpoon:list) :add)))
                   {:nargs 0}]
                  [:HarpoonUI
                   (λ []
                     (let [harpoon (require :harpoon)]
                       (harpoon.ui:toggle_quick_menu (harpoon:list) opts)))
                   {:nargs 0}]])

(λ select [nr]
  (let [harpoon (require :harpoon)]
    (: (harpoon:list) :select nr)))

(λ init []
  (let [{: create-user-cmds} (require :util.cmds)]
    (create-user-cmds user-cmds)))

(local keys [{1 :ma 2 :<cmd>HarpoonAdd<cr> :desc :Harpoon}
             {1 :mr 2 :<cmd>HarpoonUI<cr> :desc "Harpoon UI"}
             {1 :ms
              2 (λ []
                  (select 1))
              :desc "First Harpoon"}
             {1 :mt
              2 (λ []
                  (select 2))
              :desc "Second Harpoon"}
             {1 :mn
              2 (λ []
                  (select 3))
              :desc "Third Harpoon"}
             {1 :me
              2 (λ []
                  (select 4))
              :desc "Fourth Harpoon"}])

{1 :ThePrimeagen/harpoon
 :branch :harpoon2
 :event [:BufReadPost :BufNewFile]
 : init
 : keys}