Fix embark custom keymaps

This commit is contained in:
Jeremy Dormitzer 2023-03-07 10:45:57 -05:00
parent 5db4e4f331
commit 31da3b2fd0

View File

@ -58,28 +58,30 @@ targets."
(_ (key-binding prefix 'accept-default)))
keymap)
nil nil t))))
(embark-define-keymap embark-straight-map
"Keymap for actions for straight.el"
("u" straight-visit-package-website)
("r" straight-get-recipe)
("i" straight-use-package)
("c" straight-check-package)
("F" straight-pull-package)
("f" straight-fetch-package)
("p" straight-push-package)
("n" straight-normalize-package)
("m" straight-merge-package))
(defvar-keymap embark-straight-map
:doc "Keymap for actions for straight.el"
:parent embark-general-map
"u" #'straight-visit-package-website
"r" #'straight-get-recipe
"i" #'straight-use-package
"c" #'straight-check-package
"F" #'straight-pull-package
"f" #'straight-fetch-package
"p" #'straight-push-package
"n" #'straight-normalize-package
"m" #'straight-merge-package)
(add-to-list 'embark-keymap-alist '(straight . embark-straight-map))
(embark-define-keymap embark-password-store-actions
"Keymap for actions for password-store."
("c" password-store-copy)
("f" password-store-copy-field)
("i" password-store-insert)
("I" password-store-generate)
("r" password-store-rename)
("e" password-store-edit)
("k" password-store-remove)
("U" password-store-url))
(defvar-keymap embark-password-store-actions
:doc "Keymap for actions for password-store."
:parent embark-general-map
"c" #'password-store-copy
"f" #'password-store-copy-field
"i" #'password-store-insert
"I" #'password-store-generate
"r" #'password-store-rename
"e" #'password-store-edit
"k" #'password-store-remove
"U" #'password-store-url)
(add-to-list 'embark-keymap-alist '(password-store . embark-password-store-actions))
;; Add identifiers in LSP-mode as their own target type
(with-eval-after-load 'lsp-mode
@ -88,13 +90,15 @@ targets."
(when-let ((sym (embark-target-identifier-at-point)))
(cons 'lsp-identifier (cdr sym)))))
(add-to-list 'embark-target-finders 'embark-target-lsp-identifier-at-point)
(embark-define-keymap embark-lsp-identifier-actions
"Keymap for actions on LSP identifiers."
:parent embark-identifier-map
("a" lsp-execute-code-action)
("s" lsp-describe-thing-at-point))
(defun embark-lsp-execute-code-action (_target)
"Ignores the target and calls lsp-execute-code-action."
(call-interactively #'lsp-execute-code-action))
(defvar-keymap embark-lsp-identifier-actions
:doc "Keymap for actions on LSP identifiers"
:parent embark-general-map
"a" #'embark-lsp-execute-code-action
"h" #'lsp-describe-thing-at-point)
(add-to-list 'embark-keymap-alist '(lsp-identifier . embark-lsp-identifier-actions))
(add-to-list 'embark-target-injection-hooks '(lsp-execute-code-action embark--ignore-target))
(add-to-list 'embark-target-injection-hooks '(lsp-describe-thing-at-point embark--ignore-target)))
(add-to-list 'embark-target-injection-hooks '(xref-find-references embark--ignore-target))
:general