summaryrefslogtreecommitdiff
path: root/comb/orderless-conf.el
diff options
context:
space:
mode:
Diffstat (limited to 'comb/orderless-conf.el')
-rw-r--r--comb/orderless-conf.el39
1 files changed, 39 insertions, 0 deletions
diff --git a/comb/orderless-conf.el b/comb/orderless-conf.el
new file mode 100644
index 0000000..8af75e4
--- /dev/null
+++ b/comb/orderless-conf.el
@@ -0,0 +1,39 @@
+;;; -*- lexical-binding: t; -*-
+
+(use-package "orderless" 'orderless
+ (setq completion-styles '(orderless partial-completion)
+ completion-category-defaults nil
+ completion-flex-nospace nil
+ completion-pcm-complete-word-inserts-delimiters t
+ completion-show-help nil
+ completion-ignore-case t
+ read-file-name-completion-ignore-case t
+ read-buffer-completion-ignore-case t
+ resize-mini-windows t)
+
+ (setq orderless-component-separator " +"
+ orderless-matching-styles '(orderless-prefixes
+ orderless-literal
+ orderless-regexp
+ orderless-strict-leading-initialism)
+ orderless-style-dispatchers '(equal-means-literal-dispatcher
+ comma-means-initial-dispatcher))
+
+ ;; unbind space in the minibuffer
+ (define-key minibuffer-local-completion-map (vector 32) nil)
+
+ ;;; dispatchers
+
+;;;###autoload
+ (defun equal-means-literal-dispatcher (pattern _index _total)
+ "If a pattern begins with an equal sign, then we use literals."
+ (cond
+ ((= (aref pattern 0) ?=)
+ (cons 'orderless-literal (substring pattern 1)))))
+
+;;;###autoload
+ (defun comma-means-initial-dispatcher (pattern _index _total)
+ "If a pattern begins with a comma, then we use initials to match."
+ (cond
+ ((= (aref pattern 0) ?,)
+ (cons 'orderless-strict-leading-initialism (substring pattern 1))))))