summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--init.org17
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