diff options
Diffstat (limited to 'users/wpcarro/emacs/.emacs.d')
-rw-r--r-- | users/wpcarro/emacs/.emacs.d/wpc/bookmark.el | 27 | ||||
-rw-r--r-- | users/wpcarro/emacs/.emacs.d/wpc/keybindings.el | 6 |
2 files changed, 18 insertions, 15 deletions
diff --git a/users/wpcarro/emacs/.emacs.d/wpc/bookmark.el b/users/wpcarro/emacs/.emacs.d/wpc/bookmark.el index 26c20399e2d4..c5e3bf3ac965 100644 --- a/users/wpcarro/emacs/.emacs.d/wpc/bookmark.el +++ b/users/wpcarro/emacs/.emacs.d/wpc/bookmark.el @@ -21,7 +21,7 @@ (require 'f) (require 'buffer) -(require 'list) +(require 'dash) (require 'string) (require 'set) (require 'constants) @@ -66,21 +66,24 @@ ((f-file? path) (funcall bookmark-handle-file path))))) +(defun bookmark-install-kbd (b) + "Define two functions to explore B and assign them to keybindings." + (eval `(defun ,(intern (format "bookmark-visit-%s" (bookmark-label b))) () + (interactive) + (find-file ,(bookmark-path b)))) + (eval `(defun ,(intern (format "bookmark-browse-%s" (bookmark-label b))) () + (interactive) + (bookmark-open ,b))) + (general-define-key + :prefix "<SPC>" + :states '(motion) + (format "J%s" (bookmark-kbd b)) `,(intern (format "bookmark-visit-%s" (bookmark-label b))) + (format "j%s" (bookmark-kbd b)) `,(intern (format "bookmark-browse-%s" (bookmark-label b))))) (defun bookmark-install-kbds () "Install the keybindings defined herein." (->> bookmark-whitelist - (list-map - (lambda (b) - (general-define-key - :prefix "<SPC>" - :states '(normal) - (format "J%s" (bookmark-kbd b)) - (lambda () (interactive) (find-file (bookmark-path b))) - (format "j%s" (bookmark-kbd b)) - ;; TODO: Consider `cl-labels' so `which-key' minibuffer is more - ;; helpful. - (lambda () (interactive) (bookmark-open b))))))) + (-map #'bookmark-install-kbd))) (provide 'bookmark) ;;; bookmark.el ends here diff --git a/users/wpcarro/emacs/.emacs.d/wpc/keybindings.el b/users/wpcarro/emacs/.emacs.d/wpc/keybindings.el index 25c026c09e43..a90da9af5975 100644 --- a/users/wpcarro/emacs/.emacs.d/wpc/keybindings.el +++ b/users/wpcarro/emacs/.emacs.d/wpc/keybindings.el @@ -53,9 +53,6 @@ ;; General Keybindings ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Install KBDs like <SPC>jb to search through my monorepo. -(bookmark-install-kbds) - ;; Ensure that evil's command mode behaves with readline bindings. (general-define-key :keymaps 'evil-ex-completion-map @@ -383,5 +380,8 @@ "<SPC>" #'buffer-show-previous "k" #'kill-buffer) +;; Install KBDs like <SPC>jb to search through my monorepo. +(bookmark-install-kbds) + (provide 'keybindings) ;;; keybindings.el ends here |