diff options
-rw-r--r-- | custom/jao-custom-completion.el | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el index 3d9c543..573589d 100644 --- a/custom/jao-custom-completion.el +++ b/custom/jao-custom-completion.el @@ -1,14 +1,13 @@ ;; -*- lexical-binding: t; -*- ;;; completion styles -;;;; completion configuration (setq tab-always-indent 'complete read-extended-command-predicate #'command-completion-default-include-p completion-category-defaults nil - completion-cycle-threshold nil + completion-cycle-threshold 4 completions-detailed t completion-show-help nil - completion-show-inline-help nil + completion-show-inline-help t completion-ignore-case t completion-wrap-movement t completion-auto-select nil @@ -20,7 +19,7 @@ (symbol (styles initials substring partial-completion)) (variable (styles initials substring partial-completion)))) -;;;; crm indicator +;;; crm indicator (defun jao-completion--crm-indicator (args) "Add prompt indicator to `completing-read-multiple' filter ARGS." (cons (concat "[CRM] " (car args)) (cdr args))) @@ -31,23 +30,19 @@ ;;; orderless (use-package orderless :ensure t + :demand t :init - :config (orderless-define-completion-style orderless+initialism (orderless-matching-styles '(orderless-initialism orderless-prefixes orderless-literal orderless-regexp))) - (defun jao-orderless--set-locally () - (setq-local completion-styles '(orderless basic) - completion-category-overrides - '((file (styles partial-completion orderless)) - (command (styles orderless+initialism))) - orderless-matching-styles - '(orderless-literal orderless-regexp orderless-prefixes))) - - (add-hook 'minibuffer-setup-hook #'jao-orderless--set-locally)) + (setq orderless-matching-styles + '(orderless-literal orderless-regexp orderless-prefixes) + jao-orderless-overrides + '((file (styles partial-completion orderless)) + (command (styles orderless+initialism))))) ;;; marginalia (use-package marginalia @@ -66,7 +61,6 @@ ;;; vertico (use-package vertico :ensure t - :init (defvar jao-vertico-reverse t) @@ -74,15 +68,18 @@ vertico-cycle t vertico-resize t vertico-multiform-categories nil + vertico-multiform-commands + `((".*" + (completion-styles orderless basic) + (completion-category-overrides . ,jao-orderless-overrides))) vertico-buffer-display-action `(display-buffer-below-selected (window-height . 0.5))) (dolist (c '(completion-at-point complete-symbol indent-for-tab-command)) - (add-to-list 'vertico-multiform-commands - `(,c buffer (vertico-resize) (jao-vertico-reverse)))) + (let ((s `(,c buffer (vertico-resize) (jao-vertico-reverse)))) + (add-to-list 'vertico-multiform-commands s))) :config - (defun jao-vertico--display (fun lines) (if (not jao-vertico-reverse) (funcall fun lines) |