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/harpoon.fnl | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'fnl/plugins/editor/harpoon.fnl') diff --git a/fnl/plugins/editor/harpoon.fnl b/fnl/plugins/editor/harpoon.fnl index 167cf3b..8a9818f 100644 --- a/fnl/plugins/editor/harpoon.fnl +++ b/fnl/plugins/editor/harpoon.fnl @@ -1,12 +1,37 @@ ;; Harpoon files for navigation. +(local user-cmds [[:HarpoonAdd + (lambda [] + (let [harpoon (require :harpoon.mark)] + (harpoon.add_file))) + {:nargs 0}] + [:HarpoonNext + (lambda [] + (let [harpoon (require :harpoon.ui)] + (harpoon.nav_next))) + {:nargs 0}] + [:HarpoonPrev + (lambda [] + (let [harpoon (require :harpoon.ui)] + (harpoon.nav_prev))) + {:nargs 0}] + [:HarpoonUI + (lambda [] + (let [harpoon (require :harpoon.ui)] + (harpoon.toggle_quick_menu))) + {:nargs 0}]]) + (fn telescope-ext [ext fun opts] (let [telescope (require :telescope) themes (require :telescope.themes) theme (. opts :theme)] ((. (. (. telescope :extensions) ext) fun) ((. themes theme) opts)))) -(fn setup [] +(fn init [] + (let [cmds (require :util.cmds)] + (cmds.create-user-cmds user-cmds))) + +(fn config [] (vim.keymap.set :n : (fn [] (telescope-ext :harpoon :marks @@ -22,9 +47,9 @@ {1 :ThePrimeagen/harpoon :event :BufReadPost + : init :keys [{1 :ma 2 :HarpoonAdd :desc :Harpoon} {1 :mr 2 :HarpoonUI :desc "Harpoon UI"} {1 :ms 2 :HarpoonPrev :desc "Harpoon Prev"} {1 :mt 2 :HarpoonNext :desc "Harpoon Next"}] - :config (fn [] - (setup))} + : config} -- cgit v1.2.3-70-g09d2