diff options
author | Franck Cuny <franck@fcuny.net> | 2023-06-07 11:20:10 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2023-06-07 11:20:10 -0700 |
commit | eb70b20edda10023736331f948b5a47349b22315 (patch) | |
tree | 41440c874ab838df9b99333957797f3c000480c8 | |
parent | ensure the package for yaml-mode is installed (diff) | |
download | emacs.d-eb70b20edda10023736331f948b5a47349b22315.tar.gz |
send completion candidate when inside eshell
Change-Id: I9f73b17723fee7a241c40d41c9b399949e26d4a9
-rw-r--r-- | init.org | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/init.org b/init.org index 34f81f7..958909d 100644 --- a/init.org +++ b/init.org @@ -381,6 +381,15 @@ Automatically revert buffers if the file has changed on disk. ("M-d" . corfu-info-documentation) ("M-l" . corfu-info-location) ("M-." . corfu-move-to-minibuffer)) + :preface + ;; see https://github.com/minad/corfu#completing-in-the-eshell-or-shell + (defun corfu-send-shell (&rest _) + "Send completion candidate when inside comint/eshell." + (cond + ((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input)) + (eshell-send-input)) + ((and (derived-mode-p 'comint-mode) (fboundp 'comint-send-input)) + (comint-send-input)))) :custom ;; Works with `indent-for-tab-command'. Make sure tab doesn't indent when you ;; want to perform completion @@ -413,6 +422,14 @@ Automatically revert buffers if the file has changed on disk. ;; Other (corfu-echo-documentation nil) ; Already use corfu-popupinfo + :init + ;; see https://github.com/minad/corfu#completing-in-the-eshell-or-shell + (add-hook 'eshell-mode-hook + (lambda () + (setq-local corfu-auto nil) + (corfu-mode))) + (advice-add #'corfu-insert :after #'corfu-send-shell) + :config (global-corfu-mode)) #+end_src |