diff options
Diffstat (limited to 'emacs')
-rw-r--r-- | emacs/init.el | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/emacs/init.el b/emacs/init.el index 9992fec..2dc275a 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -44,6 +44,9 @@ (read-buffer-completion-ignore-case t) (read-file-name-completion-ignore-case t) (completion-ignore-case t) + :config + (add-to-list 'vertico-multiform-categories '(embark-keybinding grid)) +(vertico-multiform-mode) ) (use-package vertico-directory :after vertico @@ -145,6 +148,66 @@ and when JID is not in `jabber-activity-banned'." ([remap yank-pop] . consult-yank-pop) ;; like normal yank-pop but with live preview ([remap goto-line] . consult-goto-line))) +(use-package embark + :ensure t + :bind (("C-<menu>" . embark-act) + ("C-<return>" . embark-export) + ([remap describe-bindings] . embark-bindings) + ("M-." . embark-dwim)) + :hook (eldoc-documentation-functions . embark-eldoc-first-target) + :custom + (eldoc-documentation-strategy 'eldoc-documentation-compose-eagerly) + + + ) + + (setq prefix-help-command #'embark-prefix-help-command) + +(defun embark-which-key-indicator () + "An embark indicator that displays keymaps using which-key. +The which-key help message will show the type and value of the +current target followed by an ellipsis if there are further +targets." + (lambda (&optional keymap targets prefix) + (if (null keymap) + (which-key--hide-popup-ignore-command) + (which-key--show-keymap + (if (eq (plist-get (car targets) :type) 'embark-become) + "Become" + (format "Act on %s '%s'%s" + (plist-get (car targets) :type) + (embark--truncate-target (plist-get (car targets) :target)) + (if (cdr targets) "…" ""))) + (if prefix + (pcase (lookup-key keymap prefix 'accept-default) + ((and (pred keymapp) km) km) + (_ (key-binding prefix 'accept-default))) + keymap) + nil nil t (lambda (binding) + (not (string-suffix-p "-argument" (cdr binding)))))))) + +(setopt embark-indicators + '(embark--vertico-indicator + embark-which-key-indicator + embark-minimal-indicator + embark-highlight-indicator + embark-isearch-highlight-indicator)) + +(defun embark-hide-which-key-indicator (fn &rest args) + "Hide the which-key indicator immediately when using the completing-read prompter." + (which-key--hide-popup-ignore-command) + (let ((embark-indicators + (remq #'embark-which-key-indicator embark-indicators))) + (apply fn args))) + +(advice-add #'embark-completing-read-prompter + :around #'embark-hide-which-key-indicator) + +(use-package embark-consult + :ensure t ; only need to install it, embark loads it after consult if found + :hook + (embark-collect-mode . consult-preview-at-point-mode)) + (use-package marginalia :ensure t :after vertico @@ -911,7 +974,7 @@ and when JID is not in `jabber-activity-banned'." :custom (which-key-popup-type 'side-window) (which-key-side-window-location 'bottom) - (which-key-side-window-max-height 3) + (which-key-side-window-max-height 12) (which-key-persistent-popup nil) (which-key-show-prefix 'echo) (which-key-idle-delay 0) |