bar.el (4151B)
1 (use-package marginalia 2 :ensure t 3 :config 4 (setq marginalia-annotators 5 '(marginalia-annotators-heavy 6 marginalia-annotators-light)) 7 (marginalia-mode 1)) 8 (use-package minibuffer 9 :hook (after-init . minibuffer-depth-indicate-mode) ; recursion depth 10 :config 11 (setq enable-recursive-minibuffers t) 12 (setq completion-styles '(partial-completion flex)) 13 (setq completion-auto-help nil) 14 (setq completion-flex-nospace nil) 15 (setq read-file-name-completion-ignore-case t 16 read-buffer-completion-ignore-case t) 17 (setq completion-pcm-complete-word-inserts-delimiters t) 18 ;; (setq resize-mini-windows t) 19 (setq completion-show-help nil)) 20 (use-package icomplete 21 :hook (after-init . icomplete-mode) 22 :custom 23 (icomplete-in-buffer t) 24 (icomplete-delay-completions-threshold 0) 25 :config 26 :bind (:map icomplete-minibuffer-map 27 ("<return>" . icomplete-force-complete-and-exit) 28 ("C-s" . icomplete-forward-completions) 29 ("C-n" . icomplete-forward-completions) 30 ("C-p" . icomplete-backward-completions))) 31 (use-package icomplete-vertical 32 :after icomplete 33 :hook (icomplete-mode . icomplete-vertical-mode)) 34 (defgroup prot-orderless () 35 "Tweaks for the Orderless completion style." 36 :group 'minibuffer) 37 38 (defcustom prot-orderless-default-styles 39 '(orderless-flex 40 orderless-strict-leading-initialism 41 orderless-regexp 42 orderless-prefixes 43 orderless-literal) 44 "List that should be assigned to `orderless-matching-styles'." 45 :type 'list 46 :group 'prot-orderless) 47 48 (defcustom prot-orderless-alternative-styles 49 '(orderless-literal 50 orderless-prefixes 51 orderless-strict-leading-initialism 52 orderless-regexp) 53 "Alternative list for `orderless-matching-styles'. 54 55 Unlike `prot-orderless-default-styles', this variable is intended 56 for use on a case-by-case basis, with the help of the function 57 `prot-orderless-with-styles'." 58 :type 'list 59 :group 'prot-orderless) 60 61 (defun prot-orderless-literal-dispatcher (pattern _index _total) 62 "Literal style dispatcher using the equals sign as a suffix. 63 It matches PATTERN _INDEX and _TOTAL according to how Orderless 64 parses its input." 65 (when (string-suffix-p "=" pattern) 66 `(orderless-literal . ,(substring pattern 0 -1)))) 67 68 (defun prot-orderless-initialism-dispatcher (pattern _index _total) 69 "Leading initialism dispatcher using the comma suffix. 70 It matches PATTERN _INDEX and _TOTAL according to how Orderless 71 parses its input." 72 (when (string-suffix-p "," pattern) 73 `(orderless-strict-leading-initialism . ,(substring pattern 0 -1)))) 74 75 (defvar orderless-matching-styles) 76 77 (defun prot-orderless-with-styles (cmd &optional styles) 78 "Call CMD with optional orderless STYLES. 79 80 STYLES is a list of pattern matching methods that is passed to 81 `orderless-matching-styles'. Its fallback value is that of 82 `prot-orderless-alternative-styles'." 83 (let ((orderless-matching-styles (or styles prot-orderless-alternative-styles)) 84 (this-command cmd)) 85 (call-interactively cmd))) 86 87 (use-package orderless 88 :config 89 (setq prot-orderless-default-styles 90 '(orderless-prefixes 91 orderless-literal 92 orderless-strict-leading-initialism 93 orderless-regexp 94 orderless-flex)) 95 (setq prot-orderless-alternative-styles 96 '(orderless-literal 97 orderless-prefixes 98 orderless-strict-leading-initialism 99 orderless-regexp)) 100 (setq orderless-component-separator " +") 101 (setq orderless-matching-styles prot-orderless-default-styles) 102 (setq orderless-style-dispatchers 103 '(prot-orderless-literal-dispatcher 104 prot-orderless-initialism-dispatcher)) 105 ;; SPC should never complete: use it for `orderless' groups. 106 :bind (:map minibuffer-local-completion-map 107 ("SPC" . nil))) 108 109 (setq completion-styles 110 '(partial-completion basic flex initials substring) 111 completion-category-overrides 112 '((file (styles basic flex initials substring)) 113 (buffer (styles basic flex initials substring)) 114 (info-menu (styles basic flex initials substring))))