summaryrefslogtreecommitdiffhomepage
path: root/custom
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-07-22 03:24:47 +0100
committerjao <jao@gnu.org>2022-07-22 03:24:47 +0100
commit8308d63f20923616891907d0bb5fabc1acb68cde (patch)
treedd42ad40d87bbcecbb154b6558a4f3ac938cadaa /custom
parentbda3bcd3e86b689b3d092b8028d141477de75da0 (diff)
downloadelibs-8308d63f20923616891907d0bb5fabc1acb68cde.tar.gz
elibs-8308d63f20923616891907d0bb5fabc1acb68cde.tar.bz2
corfu config
Diffstat (limited to 'custom')
-rw-r--r--custom/jao-custom-completion.el47
-rw-r--r--custom/jao-custom-gnus.el1
2 files changed, 47 insertions, 1 deletions
diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el
index 7a604e4..0e36fcc 100644
--- a/custom/jao-custom-completion.el
+++ b/custom/jao-custom-completion.el
@@ -126,7 +126,52 @@
("RET" . company-complete-selection))
:diminish)
-(unless nil (display-graphic-p) (global-company-mode 1))
+(unless (display-graphic-p) (global-company-mode 1))
+
+;;; corfu
+(use-package corfu
+ :ensure t
+ :init (setq corfu-echo-documentation 0.25
+ corfu-cycle t
+ corfu-count 15
+ corfu-quit-no-match t
+ corfu-auto t
+ corfu-commit-predicate nil
+ corfu-preview-current nil
+ corfu-preselect-first t
+ corfu-min-width 20
+ corfu-max-width 100)
+ :config
+
+ ;; show eldoc string immediately after accepted completion too
+ (with-eval-after-load "eldoc"
+ (eldoc-add-command-completions "corfu-"))
+
+ (defun jao-corfu--active-p ()
+ (and (>= corfu--index 0) (/= corfu--index corfu--preselect)))
+
+ (defun jao-corfu-quit-or-insert ()
+ (interactive)
+ (if (jao-corfu--active-p) (corfu-insert) (corfu-quit)))
+
+ (defun jao-corfu-quit-or-previous ()
+ (interactive)
+ (if (jao-corfu--active-p)
+ (corfu-previous)
+ (corfu-quit)
+ (previous-line)))
+
+ :bind (:map corfu-map
+ ("C-<return>" . corfu-insert)
+ ("\r" . jao-corfu-quit-or-insert)
+ ("C-p" . jao-corfu-quit-or-previous)))
+
+(defun corfu-in-minibuffer ()
+ (when (not (bound-and-true-p vertico--input)) (corfu-mode 1)))
+
+(add-hook 'minibuffer-setup-hook #'corfu-in-minibuffer 1)
+
+(when (display-graphic-p) (global-corfu-mode 1))
;;; vertico
(use-package vertico
diff --git a/custom/jao-custom-gnus.el b/custom/jao-custom-gnus.el
index f415f63..d012773 100644
--- a/custom/jao-custom-gnus.el
+++ b/custom/jao-custom-gnus.el
@@ -390,6 +390,7 @@
(add-hook 'gnus-select-group-hook 'gnus-group-set-timestamp)
(add-hook 'gnus-group-mode-hook 'gnus-topic-mode)
+
;;;; open mail file in gnus
(defun jao-gnus-file-to-group (file &optional maildir newsdir m-server n-server)
"Compute the Gnus group name from the given file name.