2021-01-16 03:04:18 +08:00
|
|
|
;;; completion/selectrum/config.el -*- lexical-binding: t; -*-
|
|
|
|
|
|
|
|
(use-package! selectrum
|
2021-01-16 20:21:50 +08:00
|
|
|
:hook (doom-first-input . selectrum-mode)
|
2021-02-16 16:46:35 -06:00
|
|
|
:init
|
|
|
|
(setq selectrum-display-action nil
|
|
|
|
selectrum-num-candidates-displayed 15
|
|
|
|
selectrum-extend-current-candidate-highlight t
|
2021-01-16 20:21:50 +08:00
|
|
|
selectrum-fix-minibuffer-height t)
|
2021-02-16 16:46:35 -06:00
|
|
|
(when (featurep! +orderless)
|
|
|
|
|
|
|
|
(setq completion-styles '(substring partial-completion)
|
|
|
|
selectrum-refine-candidates-function #'orderless-filter
|
|
|
|
selectrum-highlight-candidates-function #'orderless-highlight-matches))
|
2021-01-16 03:04:18 +08:00
|
|
|
|
2021-02-16 16:46:35 -06:00
|
|
|
|
|
|
|
:config
|
|
|
|
(defadvice! +selectrum-refresh-on-cycle (&rest _)
|
|
|
|
:after 'marginalia-cycle
|
|
|
|
(when (bound-and-true-p selectrum-mode) (selectrum-exhibit)))
|
|
|
|
|
|
|
|
(map!
|
|
|
|
:g "C-s-r" #'selectrum-repeat
|
|
|
|
(:map selectrum-minibuffer-map
|
|
|
|
:geni "M-RET" #'selectrum-submit-exact-input
|
|
|
|
:geni "C-j" #'selectrum-next-candidate
|
|
|
|
:geni "C-S-j" #'selectrum-next-page
|
|
|
|
:geni "C-s-j" #'selectrum-goto-end
|
|
|
|
:geni "C-k" #'selectrum-previous-candidate
|
|
|
|
:geni "C-S-k" #'selectrum-previous-page
|
|
|
|
:geni "C-s-k" #'selectrum-goto-beginning)))
|
2021-01-16 03:04:18 +08:00
|
|
|
|
2021-02-16 19:28:13 -06:00
|
|
|
(use-package! selectrum-prescient
|
|
|
|
:when (featurep! +prescient)
|
|
|
|
:hook (selectrum-mode . selectrum-prescient-mode)
|
|
|
|
:hook (selectrum-mode . prescient-persist-mode)
|
|
|
|
:config
|
|
|
|
(setq selectrum-preprocess-candidates-function #'selectrum-prescient--preprocess)
|
|
|
|
(add-hook 'selectrum-candidate-selected-hook #'selectrum-prescient--remember)
|
|
|
|
(add-hook 'selectrum-candidate-inserted-hook #'selectrum-prescient--remember))
|
|
|
|
|
2021-01-16 20:21:50 +08:00
|
|
|
(use-package! orderless
|
|
|
|
:when (featurep! +orderless)
|
2021-02-16 16:46:35 -06:00
|
|
|
:defer t
|
|
|
|
:init
|
|
|
|
(setq orderless-component-separator "[ &]"
|
|
|
|
orderless-matching-styles '(orderless-prefixes
|
|
|
|
orderless-initialism
|
|
|
|
orderless-regexp))
|
2021-01-16 20:21:50 +08:00
|
|
|
:config
|
2021-02-16 16:46:35 -06:00
|
|
|
(setq completion-styles '(orderless))
|
|
|
|
(setq orderless-skip-highlighting (lambda () selectrum-active-p))
|
|
|
|
(setq selectrum-highlight-candidates-function #'orderless-highlight-matches))
|
2021-01-16 20:21:50 +08:00
|
|
|
|
2021-01-16 03:04:18 +08:00
|
|
|
(use-package! consult
|
|
|
|
:defer t
|
|
|
|
:init
|
2021-01-16 20:21:50 +08:00
|
|
|
(fset 'multi-occur #'consult-multi-occur)
|
2021-01-16 03:04:18 +08:00
|
|
|
(define-key!
|
|
|
|
[remap apropos] #'consult-apropos
|
|
|
|
[remap goto-line] #'consult-goto-line
|
|
|
|
[remap imenu] #'consult-imenu
|
|
|
|
[remap switch-to-buffer] #'consult-buffer
|
|
|
|
[remap switch-to-buffer-other-window] #'consult-buffer-other-window
|
|
|
|
[remap switch-to-buffer-other-frame] #'consult-buffer-other-frame
|
|
|
|
[remap man] #'consult-man
|
|
|
|
[remap yank-pop] #'consult-yank-pop
|
|
|
|
[remap locate] #'consult-locate
|
2021-01-16 20:21:50 +08:00
|
|
|
[remap load-theme] #'consult-theme
|
|
|
|
[remap recentf-open-files] #'consult-recent-file)
|
|
|
|
:config
|
2021-02-16 16:46:35 -06:00
|
|
|
(setq consult-project-root-function #'doom-project-root)
|
|
|
|
(setq completion-in-region-function #'consult-completion-in-region)
|
|
|
|
(setq consult-narrow-key "<")
|
|
|
|
(setq consult-line-numbers-widen t)
|
|
|
|
(setq consult-async-input-debounce 0.5)
|
|
|
|
(setq consult-async-input-throttle 0.8))
|
2021-01-16 03:04:18 +08:00
|
|
|
|
2021-01-16 20:21:50 +08:00
|
|
|
(use-package! consult-flycheck
|
|
|
|
:when (featurep! :checkers syntax)
|
|
|
|
:after (consult flycheck))
|
2021-01-16 03:04:18 +08:00
|
|
|
|
|
|
|
(use-package! embark
|
2021-01-16 20:29:16 +08:00
|
|
|
:defer t
|
2021-01-16 03:04:18 +08:00
|
|
|
:init
|
2021-02-16 16:46:35 -06:00
|
|
|
(map!
|
|
|
|
:g "C-s-e" #'embark-act
|
|
|
|
(:map minibuffer-local-completion-map
|
2021-01-16 20:21:50 +08:00
|
|
|
"C-c C-o" #'embark-export
|
2021-02-16 16:46:35 -06:00
|
|
|
"C-c C-c" #'embark-act-noexit)
|
|
|
|
(:map embark-file-map
|
|
|
|
:desc "Open Dired on target" :g "j" #'ffap-dired
|
|
|
|
:desc "Open target with sudo" :g "s" #'sudo-edit
|
|
|
|
:desc "Open target with vlf" :g "l" #'vlf)
|
|
|
|
(:map embark-file-map
|
|
|
|
:desc "Cycle marginalia views" :g "A" #'marginalia-cycle))
|
|
|
|
(setq embark-action-indicator
|
|
|
|
(lambda (map)
|
|
|
|
(which-key--show-keymap "Embark" map nil nil 'no-paging)
|
|
|
|
#'which-key--hide-popup-ignore-command)
|
|
|
|
embark-become-indicator embark-action-indicator))
|
2021-01-16 03:04:18 +08:00
|
|
|
|
|
|
|
(use-package! marginalia
|
|
|
|
:after selectrum
|
|
|
|
:hook (doom-first-input . marginalia-mode)
|
|
|
|
:init
|
|
|
|
(setq-default marginalia-annotators '(marginalia-annotators-heavy)))
|
|
|
|
|
|
|
|
(use-package! embark-consult
|
|
|
|
:after (embark consult)
|
|
|
|
:hook
|
|
|
|
(embark-collect-mode . embark-consult-preview-minor-mode))
|