otavioschwanck / harpoon.el

Harpoon for emacs
GNU General Public License v3.0
93 stars 7 forks source link

Missing harpoon next/previous #7

Open jakestrahm opened 2 years ago

jakestrahm commented 2 years ago

Is there any plans to add nav_next() like in harpoon? I had bound M to next , to quickly cycle through harpoons and i can't replicate this in this package.

otavioschwanck commented 2 years ago

This harpoon doesn't have this feature. Feel free to submit a PR, the logic behind is:

vansoest commented 10 months ago

+1

MirkoHernandez commented 4 months ago

I've recently been using harpoon, great package, I really like how it integrates with project.el and how it complements activities.el. Here are some functions that I've been using for moving between harpoon buffers, maybe something similar could be integrated into harpoon. The convention is if not in an harpoon buffer move to the first one on the list.

(defun my/harpoon-next-buffer ()
  (interactive)
  (let* ((harpoon-files-array (cl-map 'vector 'identity  (split-string (harpoon--get-file-text))))
     (array-length  (length harpoon-files-array))
     (current-position (cl-position  (harpoon--buffer-file-name)
                     harpoon-files-array :test 'equal))
     (new-position (and current-position
                (if (= (1+ current-position) array-length)
                0
                  (1+ current-position)))))
    (when (> array-length 0)
      (if new-position
      (harpoon-go-to
       (+ 1 new-position))
    (harpoon-go-to 1)))))

(defun my/harpoon-previous-buffer ()
  (interactive)
  (let* ((harpoon-files-array (cl-map 'vector 'identity  (split-string (harpoon--get-file-text))))
     (array-length  (length harpoon-files-array))
     (current-position (cl-position  (harpoon--buffer-file-name)
                     harpoon-files-array :test 'equal))
     (new-position (and current-position
                (if (< (1- current-position) 0)
                (- array-length 1)
                  (1- current-position)))))
    (when (> array-length 0)
      (if new-position
      (harpoon-go-to
       (+ 1 new-position))
    (harpoon-go-to 1)))))
malbertzard commented 1 month ago

13 I added a pull request with my implementation. Maybe if the maintainer wants to it will get merged