commit e0bb836f3f825ec0bcc22fe94239a0e1d6b7f398
parent d0f1731bab471ad2a7de685a85b7c3e571e292da
Author: KΓ©vin Le Gouguec <kevin.legouguec@gmail.com>
Date: Mon, 5 Jun 2023 00:24:05 +0200
Switch to default completion UI
Mostly to avoid icomplete jank (bug#40152).
Inspired by:
<https://www.scss.tcd.ie/~sulimanm/posts/default-emacs-completion.html>
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.
Diffstat:
| M | .emacs | | | 36 | +++++++++++++++++++++++++++++------- |
1 file changed, 29 insertions(+), 7 deletions(-)
diff --git 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))