harpoon.el
harpoon.el copied to clipboard
Missing harpoon next/previous
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.
This harpoon doesn't have this feature. Feel free to submit a PR, the logic behind is:
- see if current file is in harpoon list, if is:
get the line number on harpoon go to file on next line if exists, if not, go to first harpoon
- if current file is not on harpoon go to first item in harpoon if exists
+1
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)))))
#13 I added a pull request with my implementation. Maybe if the maintainer wants to it will get merged