add Embark which might do something

This commit is contained in:
MitchMarq42 2022-07-22 06:59:25 -08:00
parent 5c7f60b56b
commit 111f0fdc65

View File

@ -175,29 +175,61 @@ be built with `xwidget' support."
:straight vertico :straight vertico
:after vertico :after vertico
:config :config
(vertico-mouse-mode) (vertico-mouse-mode))
(add-hook 'minibuffer-setup-hook #'(lambda () pixel-scroll-precision-mode -1)))
(use-package consult (use-package consult
:after vertico) :after vertico)
;; Minibuffer generic stuff ;; Minibuffer generic stuff
(use-package marginalia (use-package marginalia
;; :after ivy ;; :custom (marginalia-separator " ")
:custom (marginalia-separator " ")
:init (marginalia-mode)) :init (marginalia-mode))
(use-package orderless (use-package orderless
;; :after vertico
;; :config
;; (setq completion-category-defaults nil
;; completion-category-overrides nil)
;; :commands 'execute-extended-command
:custom :custom
(completion-styles '(orderless partial-completion basic)) (completion-styles '(orderless partial-completion basic))
(completion-category-defaults nil) (completion-category-defaults nil)
;; (completion-category-overrides '((file (styles basic partial-completion)))) ;; (completion-category-overrides '((file (styles basic partial-completion))))
(completion-category-overrides nil) (completion-category-overrides nil))
)
;; BROKEN: Relative line numbers with stuff ;; weird multi-path thing
(use-package embark
:init
;; which-key integration. Verbose and long and maybe broken.
;; taken from https://github.com/oantolin/embark/wiki/Additional-Configuration
(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))))))))
(setq embark-indicators
'(embark-which-key-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)
:config
(setq enable-recursive-minibuffers t))
;; Consult users will also want the embark-consult package.
(use-package embark-consult
:after (embark consult))
;; WORKING: Relative line numbers with stuff
(use-package linum-relative (use-package linum-relative
:diminish :diminish
:init :init