-
-
Save mrcat323/3d4867305333449393dc9f07ccf40380 to your computer and use it in GitHub Desktop.
the fork of counsel projectile bookmarks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun counsel-projectile-bookmark () | |
"Forward to `bookmark-jump' or `bookmark-set' if bookmark doesn't exist." | |
(interactive) | |
(require 'bookmark) | |
(let ((projectile-bookmarks (projectile-bookmarks))) | |
(ivy-read "Create or jump to bookmark: " | |
projectile-bookmarks | |
:action (lambda (x) | |
(cond ((and counsel-bookmark-avoid-dired | |
(member x projectile-bookmarks) | |
(file-directory-p (bookmark-location x))) | |
(with-ivy-window | |
(let ((default-directory (bookmark-location x))) | |
(counsel-find-file)))) | |
((member x projectile-bookmarks) | |
(with-ivy-window | |
(bookmark-jump x))) | |
(t | |
(bookmark-set x)))) | |
:caller 'counsel-projectile-bookmark))) | |
(ivy-set-actions | |
'counsel-projectile-bookmark | |
'(("d" bookmark-delete "delete") | |
("e" bookmark-rename "edit"))) | |
(defun projectile-bookmarks () | |
(let ((bmarks (bookmark-all-names))) | |
(cl-remove-if-not #'workspace-bookmark-p bmarks))) | |
(defun workspace-bookmark-p (bmark) | |
(let ((bmark-path (expand-file-name (bookmark-location bmark)))) | |
(string-prefix-p (bmacs-project-root) bmark-path))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment