From e0bb836f3f825ec0bcc22fe94239a0e1d6b7f398 Mon Sep 17 00:00:00 2001 From: Kévin Le Gouguec Date: Mon, 5 Jun 2023 00:24:05 +0200 Subject: Switch to default completion UI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mostly to avoid icomplete jank (bug#40152). Inspired by: Rationale for the customizations: C-M- chord for navigation Because I found myself missing C-n/C-p in a couple of situations. auto-help 'visible The feedback is not as immediate as icomplete, but it's good enough. Tried 'always, but there's a sit-for somewhere that causes a weird pause if you happen to RET before bringing up completions. auto-select 'second-tab M-v? M-g M-c?? show-help nil "Click on a selection to select it" 😏 format 'one-column Where have you been all my life. max-height 10 More often than not I'm typing something inspired by the content from another buffer, so limit how much context *Completions* can hide. auto-choose icomplete never clobbered the minibuffer until I asked it to (with e.g. C-M-i). Since C-u M-RET is a thing, keep candidates off the minibuffer unless I pull them in, in case I change my mind and start typing something entirely different from the currently highlighted candidate. --- .emacs | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/.emacs b/.emacs index af613f3..4d3ab5c 100644 --- a/.emacs +++ b/.emacs @@ -742,13 +742,6 @@ (my/list-update erc-track-exclude-types '("JOIN" "PART" "QUIT")))) -(use-package icomplete - :config - (setq icomplete-scroll t) - :custom - (icomplete-mode t) - (icomplete-vertical-mode t)) - (use-package isearch :delight "🔍" :custom @@ -778,12 +771,41 @@ (markdown-header-scaling t) (markdown-indent-on-enter 'indent-and-new-item)) +;; Gripes: +;; - underused keys: C-M-i, C-j +;; - (minibuffer-)choose-completion ignore completion-no-auto-exit +;; when the candidate is a directory: the candidate is inserted in +;; the minibuffer and the user does *not* exit the minibuffer. +;; +;; In minibuffer: +;; - TAB complete, or show/update completions +;; - TAB² jump to completions +;; - C-M-n, C-M-p highlight candidate (without changing minibuffer) +;; - RET, C-j accept minibuffer input +;; - M-RET accept highlighted candidate +;; - C-u M-RET insert highlighted candidate (without accepting) +;; +;; In completions: +;; - n, TAB, p highlight candidate (without changing minibuffer) +;; - RET accept highlighted candidate +;; - C-u RET insert highlighted candidate in minibuffer (without accepting) +;; - C-g, q back to minibuffer (use-package minibuffer :config (setq completion-ignore-case t) + (define-key completion-in-region-mode-map (kbd "C-M-n") 'minibuffer-next-completion) + (define-key completion-in-region-mode-map (kbd "C-M-p") 'minibuffer-previous-completion) + (define-key minibuffer-mode-map (kbd "C-M-n") 'minibuffer-next-completion) + (define-key minibuffer-mode-map (kbd "C-M-p") 'minibuffer-previous-completion) :custom + (completion-auto-help 'visible) + (completion-auto-select 'second-tab) + (completion-show-help nil) (completions-detailed t) + (completions-format 'one-column) (completions-group t) + (completions-max-height 10) + (minibuffer-completion-auto-choose nil) (read-buffer-completion-ignore-case t) (read-file-name-completion-ignore-case t)) -- cgit v1.2.3