diff options
author | Case Duckworth | 2021-01-22 23:27:25 -0600 |
---|---|---|
committer | Case Duckworth | 2021-01-22 23:27:25 -0600 |
commit | acafda9c59b0b7e8350fefc92bc2dfcccc4bd3f0 (patch) | |
tree | 63c52c628a30de1e11c32e14c70963febb95acf0 | |
parent | Add stuff to common-lisp-indent-function (diff) | |
download | emacs-acafda9c59b0b7e8350fefc92bc2dfcccc4bd3f0.tar.gz emacs-acafda9c59b0b7e8350fefc92bc2dfcccc4bd3f0.zip |
Add selectrum, prescient, consult, marginalia
-rw-r--r-- | config.org | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/config.org b/config.org index ed4a474..07e63af 100644 --- a/config.org +++ b/config.org | |||
@@ -494,6 +494,128 @@ to /hide/ those contents. | |||
494 | read-file-name-completion-ignore-case t) | 494 | read-file-name-completion-ignore-case t) |
495 | #+end_src | 495 | #+end_src |
496 | 496 | ||
497 | *** Selectrum :package: | ||
498 | |||
499 | My minibuffer completion system uses =selectrum=, =prescient=, =company=, | ||
500 | and =marginalia=. At some point, I'd like to take a deep dive in =embark= | ||
501 | (possibly switching out =selectrum=), =ido=, =orderless=, or others, | ||
502 | for now .... I just want to see my completions. | ||
503 | |||
504 | #+begin_src emacs-lisp :noweb-ref packages | ||
505 | (straight-use-package 'selectrum) | ||
506 | #+end_src | ||
507 | |||
508 | #+begin_src emacs-lisp :noweb-ref modes | ||
509 | (selectrum-mode +1) | ||
510 | #+end_src | ||
511 | |||
512 | *** Prescient | ||
513 | |||
514 | #+begin_src emacs-lisp :noweb-ref packages | ||
515 | (straight-use-package 'prescient) | ||
516 | (require 'prescient) | ||
517 | #+end_src | ||
518 | |||
519 | Prescient can persist itself too. | ||
520 | |||
521 | #+begin_src emacs-lisp :noweb-ref modes | ||
522 | (prescient-persist-mode +1) | ||
523 | #+end_src | ||
524 | |||
525 | Let's have =prescient= and =selectrum= work together. | ||
526 | |||
527 | #+begin_src emacs-lisp :noweb-ref packages | ||
528 | (straight-use-package 'selectrum-prescient) | ||
529 | #+end_src | ||
530 | |||
531 | #+begin_src emacs-lisp :noweb-ref modes | ||
532 | (with-eval-after-load 'selectrum | ||
533 | (selectrum-prescient-mode +1)) | ||
534 | #+end_src | ||
535 | |||
536 | *** Consult | ||
537 | |||
538 | #+begin_src emacs-lisp :noweb-ref modes | ||
539 | (straight-use-package 'consult) | ||
540 | (require 'consult) | ||
541 | #+end_src | ||
542 | |||
543 | Consult has a lot of great bindings that work well with Emacs's | ||
544 | default completion system. These all come from the [[https://github.com/minad/consult#configuration][example configuration]]. | ||
545 | |||
546 | #+begin_src emacs-lisp :noweb-ref bindings | ||
547 | (with-eval-after-load 'consult | ||
548 | ;; C-c bindings (`mode-specific-map') | ||
549 | (define-key acdw/map (kbd "C-c h") #'consult-history) | ||
550 | (define-key acdw/map (kbd "C-c m") #'consult-mode-command) | ||
551 | ;; C-x bindings (`ctl-x-map') | ||
552 | (define-key acdw/map (kbd "C-x M-:") #'consult-complex-command) | ||
553 | (define-key acdw/map (kbd "C-x b") #'consult-buffer) | ||
554 | (define-key acdw/map (kbd "C-x 4 b") #'consult-buffer-other-window) | ||
555 | (define-key acdw/map (kbd "C-x 5 b") #'consult-buffer-other-frame) | ||
556 | (define-key acdw/map (kbd "C-x r x") #'consult-register) | ||
557 | (define-key acdw/map (kbd "C-x r b") #'consult-bookmark) | ||
558 | ;; M-g bindings (`goto-map') | ||
559 | (define-key acdw/map (kbd "M-g g") #'consult-line) | ||
560 | (define-key acdw/map (kbd "M-g M-g") #'consult-line) | ||
561 | (define-key acdw/map (kbd "M-g o") #'consult-outline) | ||
562 | (define-key acdw/map (kbd "M-g m") #'consult-mark) | ||
563 | (define-key acdw/map (kbd "M-g k") #'consult-global-mark) | ||
564 | (define-key acdw/map (kbd "M-g i") #'consult-imenu) | ||
565 | (define-key acdw/map (kbd "M-g e") #'consult-error) | ||
566 | ;; M-s bindings (`search-map') | ||
567 | (define-key acdw/map (kbd "M-s g") #'consult-grep) ; alts: | ||
568 | ; consult-git-grep, | ||
569 | ; consult-ripgrep | ||
570 | (define-key acdw/map (kbd "M-s f") #'consult-find) ; alts: | ||
571 | ; consult-locate | ||
572 | (define-key acdw/map (kbd "M-s l") #'consult-line) | ||
573 | (define-key acdw/map (kbd "M-s m") #'consult-multi-occur) | ||
574 | (define-key acdw/map (kbd "M-s k") #'consult-keep-lines) | ||
575 | (define-key acdw/map (kbd "M-s u") #'consult-focus-lines) | ||
576 | ;; Other bindings | ||
577 | (define-key acdw/map (kbd "M-y") #'consult-yank-pop) | ||
578 | (define-key acdw/map (kbd "<help> a") #'consult-apropos)) | ||
579 | #+end_src | ||
580 | |||
581 | #+begin_src emacs-lisp :noweb-ref settings | ||
582 | (autoload 'consult-register-preview "consult") ; make the compiler happy | ||
583 | (setq-default register-preview-delay 0 | ||
584 | register-preview-function #'consult-register-preview) | ||
585 | #+end_src | ||
586 | |||
587 | *** Marginalia | ||
588 | |||
589 | Finally, =marginalia= provides extra information about completion | ||
590 | candidates. | ||
591 | |||
592 | #+begin_src emacs-lisp :noweb-ref packages | ||
593 | (straight-use-package 'marginalia) | ||
594 | (require 'marginalia) | ||
595 | #+end_src | ||
596 | |||
597 | #+begin_src emacs-lisp :noweb-ref modes | ||
598 | (marginalia-mode +1) | ||
599 | #+end_src | ||
600 | |||
601 | I like the rich annotations provided by =marginalia=. | ||
602 | |||
603 | #+begin_src emacs-lisp :noweb-ref settings | ||
604 | (setq-default marginalia-annotators | ||
605 | '(marginalia-annotators-heavy | ||
606 | marginalia-annotators-light | ||
607 | nil)) | ||
608 | #+end_src | ||
609 | |||
610 | **** Integration with Selectrum | ||
611 | |||
612 | #+begin_src emacs-lisp :noweb-ref functions | ||
613 | (advice-add #'marginalia-cycle :after | ||
614 | (lambda () | ||
615 | (when (bound-and-true-p selectrum-mode) | ||
616 | (selectrum-exhibit)))) | ||
617 | #+end_src | ||
618 | |||
497 | ** Completion | 619 | ** Completion |
498 | 620 | ||
499 | *** Hippie Expand | 621 | *** Hippie Expand |