Support bookmark/magit-status

Add function to quickly get `magit-status` buffers for some repositories in
which I spend time.
This commit is contained in:
William Carroll 2020-01-22 21:55:33 +00:00
parent 857ef43d2d
commit 1a2ae5499e

View file

@ -73,6 +73,17 @@ Otherwise, open with `counsel-find-file'."
(->> bookmark/whitelist
(list/find (lambda (b) (equal label (bookmark-label b))))))
(defun bookmark/magit-status ()
"Use ivy to select a bookmark and jump to its `magit-status' buffer."
(interactive)
(ivy-read "Repository: "
'("dotfiles" "mono" "tazjins-depot")
:require-match t
:action (lambda (label)
(->> label
bookmark/from-label
bookmark-path
magit-status))))
;; TODO: Consider `ivy-read' extension that takes a list of structs,
;; `struct-to-label' and `label-struct' functions.
@ -114,7 +125,11 @@ Otherwise, open with `counsel-find-file'."
(string/concat "j" (bookmark-kbd b))
;; TODO: Consider `cl-labels' so `which-key' minibuffer is more
;; helpful.
(lambda () (interactive) (bookmark/open b)))))))
(lambda () (interactive) (bookmark/open b))))))
(general-define-key
:states '(normal)
:prefix "<SPC>"
"gS" #'bookmark/magit-status))
(provide 'bookmark)
;;; bookmark.el ends here