From 9e089dab9af327d4a6b392475f54871291bc0bc3 Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 24 Jul 2021 02:11:35 +0100 Subject: corfu: auto becoming really comfortable --- completion.org | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'completion.org') diff --git a/completion.org b/completion.org index a56f1fb..b3ca9d0 100644 --- a/completion.org +++ b/completion.org @@ -40,11 +40,23 @@ corfu-count 15 corfu-quit-no-match t ; setting this to nil corfu-auto t ; and this to nil is another option - corfu-commit-predicate nil + corfu-commit-predicate nil ; when nil, we set: + orderless-component-separator "[-/]+" ; no space (it aborts) corfu-min-width 20 - corfu-max-width 100 - corfu-excluded-modes '(eshell-mode)) + corfu-max-width 100) :config + (defun jao-corfu-enable-no-auto () + (setq-local corfu-auto nil) + (corfu-mode 1)) + + (defmacro jao-corfu-no-auto (mode) + (let ((mode-name (intern (format "%s-mode" mode))) + (hook-name (intern (format "%s-mode-hook" mode)))) + `(with-eval-after-load ',mode + (add-to-list 'corfu-excluded-modes ',mode-name) + (add-hook ',hook-name #'jao-corfu-enable-no-auto)))) + + (jao-corfu-no-auto eshell) :bind (:map corfu-map ("TAB" . corfu-next) @@ -52,11 +64,6 @@ (corfu-global-mode 1) - (with-eval-after-load "eshell" - (defun jao-corfu-eshell () - (setq-local corfu-auto nil) - (corfu-mode 1)) - (add-hook 'eshell-mode-hook #'jao-corfu-eshell)) #+end_src * vertico #+begin_src emacs-lisp @@ -97,8 +104,6 @@ :bind (("C-x M-:" . consult-complex-command) ("C-x b" . consult-buffer) ("C-x C-b" . consult-buffer) - ;; ("C-x 4 b" . consult-buffer-other-window) - ;; ("C-x 5 b" . consult-buffer-other-frame) ("C-c b" . project-find-file) ("C-c B" . bookmark-set) ("C-c h" . consult-history) -- cgit v1.2.3