branch: elpa/javelin
commit 083e9642c931d0298097da53dd1f28239f2c502b
Author: Mathis Albertzard <[email protected]>
Commit: Mathis Albertzard <[email protected]>

    feat: Added command to jump to next and prev entry in list
---
 harpoon.el | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/harpoon.el b/harpoon.el
index 5acb46dd352..1fa67af1885 100644
--- a/harpoon.el
+++ b/harpoon.el
@@ -281,6 +281,26 @@
   (interactive)
   (harpoon-go-to 9))
 
+;;;###autoload
+(defun harpoon-go-to-next ()
+  "Go to the next file in harpoon."
+  (interactive)
+  (let* ((files (delete "" (split-string (harpoon--get-file-text) "\n")))
+         (current-file (harpoon--buffer-file-name))
+         (current-index (or (cl-position current-file files :test 'string=) 
-1))
+         (next-index (mod (+ current-index 1) (length files))))
+    (harpoon-go-to (1+ next-index))))
+
+;;;###autoload
+(defun harpoon-go-to-prev ()
+  "Go to the previous file in harpoon."
+  (interactive)
+  (let* ((files (delete "" (split-string (harpoon--get-file-text) "\n")))
+         (current-file (harpoon--buffer-file-name))
+         (current-index (or (cl-position current-file files :test 'string=) 
-1))
+         (prev-index (mod (+ current-index (length files) -1) (length files))))
+    (harpoon-go-to (1+ prev-index))))
+
 ;;;###autoload
 (defun harpoon-add-file ()
   "Add current file to harpoon."

Reply via email to