high-chaos organization here… replacing Ivy and Counsel and Ivy Posframe with the new hotness, this constellation of packages:
Selectrum, Prescient, and Orderless
use-package vertico
(
:init
(vertico-mode)setq completion-in-region-function
(lambda (&rest args)
(apply (if vertico-mode
(#'consult-completion-in-region
#'completion--in-region)
args)))
:bind"C-x C-z" . 'vertico-repeat))
(
use-package prescient
(
:after (vertico)
:config
(prescient-persist-mode +1)defun vertico-prescient-remember ()
("Remember the chosen candidate with Prescient."
when (>= vertico--index 0)
(
(prescient-remember
(substring-no-propertiesnth vertico--index vertico--candidates)))))
(#'vertico-insert :after #'vertico-prescient-remember)
(advice-add
:custom#'prescient-completion-sort))
(vertico-sort-function
use-package orderless
(
:after (prescient)
:custom (completion-styles '(prescient orderless)))
Consult
Consult contains a bunch of nice builtin-replacements which utilize
these other libraries to their fullest extent. consult-buffer
in particular is quite nice, for
example.
use-package consult
(
:initsetq xref-show-xrefs-function #'consult-xref
(#'consult-xref)
xref-show-definitions-function
:configsetq consult-narrow-key "<")
('projectile-project-root "projectile")
(autoload setq consult-project-root-function #'projectile-project-root)
(unless (s-contains? "--glob" consult-ripgrep-args)
(setq consult-ripgrep-args (s-concat consult-ripgrep-args
("--glob \"!*~\" .")))
:bind"C-x b" . consult-buffer)
("C-x 4 b" . consult-buffer-other-window)
("C-x 5 b" . consult-buffer-other-frame)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
(
(:map evil-leader--default-map"b" . consult-buffer)
("<SPC>" . execute-extended-command))
(
(:map evil-normal-state-map"M-y" . consult-yank-pop)
("/" . consult-line)))
(
use-package consult-flycheck
(
:bind (:map flycheck-command-map"!" . consult-flycheck))) (
Consult Buffer shouldn't preview EXWM buffers
via consult wiki, to prevent Consult Buffer from always popping exwm buffers and moving things around, I apply this monkeypatch which filters them out of consideration for preview.
defun consult-buffer-state-no-x ()
("Buffer state function that doesn't preview X buffers."
(lexical-let ((orig-state (consult--buffer-state))lambda (action cand)
(filter (if (or (not cand)
(eq action 'return)
(let ((buffer (get-buffer cand)))
(and buffer
(not (eq 'exwm-mode (buffer-local-value 'major-mode buffer))))))
(
candnil))))
lambda (action cand)
(funcall orig-state action (funcall filter action cand)))))
(
'consult
(with-eval-after-load setq consult--source-buffer
(#'consult-buffer-state-no-x))) (plist-put consult--source-buffer :state
Embark and Marginalia
use-package marginalia
(
:config (marginalia-mode)
:bind"M-A" . marginalia-cycle)
((
:map minibuffer-local-map"M-A" . marginalia-cycle)))
(
use-package embark
(
:bind"C-S-a" . embark-act) ;; pick some comfortable binding
(("C-h b" . embark-bindings)) ;; alternative for `describe-bindings'
(
setq prefix-help-command #'embark-prefix-help-command)
:init (
:config;; Hide the mode line of the Embark live/completions buffers
'display-buffer-alist
(add-to-list "\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
'(nil
(window-parameters (mode-line-format . none)))))
;; Consult users will also want the embark-consult package.
use-package embark-consult
(
:after (embark consult)t) :demand
Mini Frame
this is disabled because it doesn't work well with xmonad.
The only interesting things here is that i set parent-frame
to nil
similar to how i have to configure Ivy Posframe – this is for EXWM windowing support. I also disable the
mini-frame in a bunch of spots.
use-package mini-frame
(
:config
(mini-frame-mode +1)setq resize-mini-frames t)
(setq mini-frame-show-parameters
(nil)
'((parent-frame . 25)
(top . 1)
(height . 0.7)
(width . 0.5)))
(left . dolist (cmd '(calcDigit-start
(
background-shell-command
evil-ex
consult-line
org-fc-type-text-input-setup
consult-ripgrep))'mini-frame-ignore-commands cmd))) (add-to-list