From d69ce8314c77c53e1fe6cd22536c6a81eba04be1 Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Wed, 14 Feb 2024 10:55:14 +0100 Subject: Update harpoon with select api --- fnl/plugins/comment.fnl | 10 +++++----- fnl/plugins/harpoon.fnl | 32 ++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 17 deletions(-) (limited to 'fnl') diff --git a/fnl/plugins/comment.fnl b/fnl/plugins/comment.fnl index 66abb33..ded75df 100644 --- a/fnl/plugins/comment.fnl +++ b/fnl/plugins/comment.fnl @@ -1,21 +1,21 @@ ;; Language aware commenting. (local opts {:toggler {;; Line-comment toggle keymap - :line :mcc + :line :mpc ;; Block-comment toggle keymap :block :mbc} ;; LHS of operator-pending mappings in NORMAL and VISUAL mode :opleader {;; Line-comment keymap - :line :mc + :line :mp ;; Block-comment keymap :block :mb} ;; LHS of extra mappings :extra {;; Add comment on the line above - :above :mcO + :above :mpO ;; Add comment on the line below - :below :mco + :below :mpo ;; Add comment at the end of line - :eol :mcA}}) + :eol :mpA}}) (local user-cmds [[:CommentNormal (lambda [] diff --git a/fnl/plugins/harpoon.fnl b/fnl/plugins/harpoon.fnl index 10727a2..938095d 100644 --- a/fnl/plugins/harpoon.fnl +++ b/fnl/plugins/harpoon.fnl @@ -5,16 +5,6 @@ (let [harpoon (require :harpoon)] (: (harpoon:list) :append))) {:nargs 0}] - [:HarpoonNext - (lambda [] - (let [harpoon (require :harpoon)] - (: (harpoon:list) :next))) - {:nargs 0}] - [:HarpoonPrev - (lambda [] - (let [harpoon (require :harpoon)] - (: (harpoon:list) :prev))) - {:nargs 0}] [:HarpoonUI (lambda [] (let [harpoon (require :harpoon)] @@ -27,6 +17,10 @@ theme (. opts :theme)] ((. (. (. telescope :extensions) ext) fun) ((. themes theme) opts)))) +(lambda select [nr] + (let [harpoon (require :harpoon)] + (: (harpoon:list) :select nr))) + (fn init [] (let [cmds (require :util.cmds)] (cmds.create-user-cmds user-cmds))) @@ -44,8 +38,22 @@ (local 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"}]) + {1 :ms + 2 (fn [] + (select 1)) + :desc "First Harpoon"} + {1 :mt + 2 (fn [] + (select 2)) + :desc "Second Harpoon"} + {1 :mn + 2 (fn [] + (select 3)) + :desc "Third Harpoon"} + {1 :me + 2 (fn [] + (select 4)) + :desc "Fourth Harpoon"}]) {1 :ThePrimeagen/harpoon :branch :harpoon2 -- cgit v1.2.3-70-g09d2