summaryrefslogtreecommitdiff
path: root/fnl/plugins/harpoon.fnl
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2024-01-05 01:50:20 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2024-01-05 01:50:20 +0100
commit2a94573f54c69a9af7536586ab2c03eb88bda5e7 (patch)
tree48e430773d56baef8c751fb8a6b4d76303b61636 /fnl/plugins/harpoon.fnl
parent16198ca3bcd0ddd61f8d18280769c6f226b2b7ce (diff)
Refactor
Diffstat (limited to 'fnl/plugins/harpoon.fnl')
-rw-r--r--fnl/plugins/harpoon.fnl53
1 files changed, 53 insertions, 0 deletions
diff --git a/fnl/plugins/harpoon.fnl b/fnl/plugins/harpoon.fnl
new file mode 100644
index 0000000..0791f98
--- /dev/null
+++ b/fnl/plugins/harpoon.fnl
@@ -0,0 +1,53 @@
+;; 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 init []
+ (let [cmds (require :util.cmds)]
+ (cmds.create-user-cmds user-cmds)))
+
+(fn config []
+ (vim.keymap.set :n :<tab>
+ (fn []
+ (telescope-ext :harpoon :marks
+ {:theme :get_dropdown
+ :previewer false
+ :initial_mode :normal
+ :prompt_title :Harpoon}))
+ {})
+ (vim.keymap.set :n :<s-tab>
+ "<cmd>Telescope buffers theme=dropdown previewer=false initial_mode=normal<cr>"
+ {})
+ {:menu {:width (- (vim.api.nvim_win_get_width 0) 4)}})
+
+(local keys [{1 :ma 2 :<cmd>HarpoonAdd<cr> :desc :Harpoon}
+ {1 :mr 2 :<cmd>HarpoonUI<cr> :desc "Harpoon UI"}
+ {1 :ms 2 :<cmd>HarpoonPrev<cr> :desc "Harpoon Prev"}
+ {1 :mt 2 :<cmd>HarpoonNext<cr> :desc "Harpoon Next"}])
+
+{1 :ThePrimeagen/harpoon :event :BufReadPost : init : keys : config}