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:
parent
857ef43d2d
commit
1a2ae5499e
1 changed files with 16 additions and 1 deletions
|
@ -73,6 +73,17 @@ Otherwise, open with `counsel-find-file'."
|
||||||
(->> bookmark/whitelist
|
(->> bookmark/whitelist
|
||||||
(list/find (lambda (b) (equal label (bookmark-label b))))))
|
(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,
|
;; TODO: Consider `ivy-read' extension that takes a list of structs,
|
||||||
;; `struct-to-label' and `label-struct' functions.
|
;; `struct-to-label' and `label-struct' functions.
|
||||||
|
@ -114,7 +125,11 @@ Otherwise, open with `counsel-find-file'."
|
||||||
(string/concat "j" (bookmark-kbd b))
|
(string/concat "j" (bookmark-kbd b))
|
||||||
;; TODO: Consider `cl-labels' so `which-key' minibuffer is more
|
;; TODO: Consider `cl-labels' so `which-key' minibuffer is more
|
||||||
;; helpful.
|
;; helpful.
|
||||||
(lambda () (interactive) (bookmark/open b)))))))
|
(lambda () (interactive) (bookmark/open b))))))
|
||||||
|
(general-define-key
|
||||||
|
:states '(normal)
|
||||||
|
:prefix "<SPC>"
|
||||||
|
"gS" #'bookmark/magit-status))
|
||||||
|
|
||||||
(provide 'bookmark)
|
(provide 'bookmark)
|
||||||
;;; bookmark.el ends here
|
;;; bookmark.el ends here
|
||||||
|
|
Loading…
Reference in a new issue