184 lines
6.0 KiB
Org Mode
184 lines
6.0 KiB
Org Mode
:PROPERTIES:
|
|
:ID: cce/selectrum_etc
|
|
:END:
|
|
#+TITLE: Completing Read Replacement and Extension
|
|
#+filetags: :CCE:
|
|
#+AUTO_TANGLE: t
|
|
|
|
#+PROPERTY: header-args :mkdirp yes :results none
|
|
#+PROPERTY: header-args:emacs-lisp :tangle selectrum.el :comments none
|
|
|
|
#+ARCOLOGY_KEY: cce/completing-read
|
|
#+ARCOLOGY_ALLOW_CRAWL: t
|
|
|
|
#+ARROYO_EMACS_MODULE: selectrum
|
|
#+ARROYO_MODULE_WANTS: cce/configure_packaging.org
|
|
|
|
high-chaos organization here... replacing [[id:cce/ivy_and_counsel][Ivy and Counsel]] and [[id:cce/ivy_posframe][Ivy Posframe]] with the new hotness, this constellation of packages:
|
|
|
|
* [[https://github.com/raxod502/selectrum][Selectrum]], [[https://github.com/raxod502/prescient.el][Prescient]], and [[https://github.com/oantolin/orderless][Orderless]]
|
|
:PROPERTIES:
|
|
:ID: selectrum-prescient-orderless
|
|
:ROAM_ALIASES: Prescient Selectrum Orderless
|
|
:END:
|
|
|
|
#+begin_src emacs-lisp
|
|
(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-properties
|
|
(nth vertico--index vertico--candidates)))))
|
|
(advice-add #'vertico-insert :after #'vertico-prescient-remember)
|
|
:custom
|
|
(vertico-sort-function #'prescient-completion-sort))
|
|
|
|
(use-package orderless
|
|
:after (prescient)
|
|
:custom
|
|
(completion-styles '(prescient orderless)))
|
|
#+end_src
|
|
|
|
* [[https://github.com/minad/consult][Consult]]
|
|
:PROPERTIES:
|
|
:ID: consult
|
|
:ROAM_ALIASES: Consult
|
|
:END:
|
|
|
|
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.
|
|
|
|
#+begin_src emacs-lisp
|
|
(use-package consult
|
|
:init
|
|
(setq xref-show-xrefs-function #'consult-xref
|
|
xref-show-definitions-function #'consult-xref)
|
|
:config
|
|
(setq consult-narrow-key "<")
|
|
(autoload 'projectile-project-root "projectile")
|
|
(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)))
|
|
#+end_src
|
|
|
|
** Consult Buffer shouldn't preview [[id:cce/exwm][EXWM]] buffers
|
|
|
|
via [[https://github.com/minad/consult/wiki][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.
|
|
|
|
#+begin_src emacs-lisp
|
|
(defun consult-buffer-state-no-x ()
|
|
"Buffer state function that doesn't preview X buffers."
|
|
(lexical-let ((orig-state (consult--buffer-state))
|
|
(filter (lambda (action cand)
|
|
(if (or (not cand)
|
|
(eq action 'return)
|
|
(let ((buffer (get-buffer cand)))
|
|
(and buffer
|
|
(not (eq 'exwm-mode (buffer-local-value 'major-mode buffer))))))
|
|
cand
|
|
nil))))
|
|
(lambda (action cand)
|
|
(funcall orig-state action (funcall filter action cand)))))
|
|
|
|
(with-eval-after-load 'consult
|
|
(setq consult--source-buffer
|
|
(plist-put consult--source-buffer :state #'consult-buffer-state-no-x)))
|
|
#+end_src
|
|
|
|
* [[https://github.com/oantolin/embark/][Embark]] and [[https://github.com/minad/marginalia][Marginalia]]
|
|
:PROPERTIES:
|
|
:ID: embark-and-marginalia
|
|
:ROAM_ALIASES: Marginalia Embark
|
|
:END:
|
|
|
|
#+begin_src emacs-lisp
|
|
(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'
|
|
|
|
:init (setq prefix-help-command #'embark-prefix-help-command)
|
|
|
|
:config
|
|
;; Hide the mode line of the Embark live/completions buffers
|
|
(add-to-list 'display-buffer-alist
|
|
'("\\`\\*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)
|
|
:demand t)
|
|
#+end_src
|
|
|
|
* [[https://github.com/muffinmad/emacs-mini-frame][Mini Frame]]
|
|
:PROPERTIES:
|
|
:ID: mini-frame
|
|
:ROAM_ALIASES: "Mini Frame"
|
|
:END:
|
|
|
|
: 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 [[id:cce/ivy_posframe][Ivy Posframe]] -- this is for [[id:cce/exwm][EXWM]] windowing support. I also disable the mini-frame in a bunch of spots.
|
|
|
|
#+begin_src emacs-lisp :tangle no
|
|
(use-package mini-frame
|
|
:config
|
|
(mini-frame-mode +1)
|
|
(setq resize-mini-frames t)
|
|
(setq mini-frame-show-parameters
|
|
'((parent-frame . nil)
|
|
(top . 25)
|
|
(height . 1)
|
|
(width . 0.7)
|
|
(left . 0.5)))
|
|
(dolist (cmd '(calcDigit-start
|
|
background-shell-command
|
|
evil-ex
|
|
consult-line
|
|
org-fc-type-text-input-setup
|
|
consult-ripgrep))
|
|
(add-to-list 'mini-frame-ignore-commands cmd)))
|
|
#+end_src
|
|
|