[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/corfu f98d239 02/29: Add support for cycling
|
From: |
Stefan Monnier |
|
Subject: |
[elpa] externals/corfu f98d239 02/29: Add support for cycling |
|
Date: |
Fri, 16 Apr 2021 18:44:12 -0400 (EDT) |
branch: externals/corfu
commit f98d239007b44bb09dd35c7fff77beae5facc8da
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Add support for cycling
---
README.org | 16 ++++++++++++++--
corfu.el | 14 ++++++++++++--
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/README.org b/README.org
index bcdff9e..6bd0139 100644
--- a/README.org
+++ b/README.org
@@ -53,10 +53,22 @@ completion. Here is an example configuration:
:init
(setq tab-always-indent 'complete))
- ;; Enable corfu
+ ;; Configure corfu
(use-package corfu
+ ;; Optionally use TAB for cycling, default is `corfu-complete'.
+ ;; :bind (:map corfu-map
+ ;; ("TAB" . corfu-next)
+ ;; ("S-TAB" . corfu-previous))
+
+ ;; Enable the overlay only for certain modes.
+ ;; For example it is not a useful UI for completions at point in the
+ ;; minibuffer.
:hook ((prog-mode . corfu-mode)
- (eshell-mode . corfu-mode)))
+ (eshell-mode . corfu-mode))
+
+ ;; Optionall enable cycling for `corfu-next' and `corfu-previous'.
+ ;; (setq corfu-cycle t)
+ )
;; Use the `orderless' completion style.
;; Enable `partial-completion' for files to allow path expansion.
diff --git a/corfu.el b/corfu.el
index 498b80c..31723f4 100644
--- a/corfu.el
+++ b/corfu.el
@@ -47,6 +47,10 @@
"Maximal number of candidates to show."
:type 'integer)
+(defcustom corfu-cycle nil
+ "Enable cycling for `corfu-next' and `corfu-previous'."
+ :type 'boolean)
+
(defgroup corfu-faces nil
"Faces used by Corfu."
:group 'corfu
@@ -328,12 +332,18 @@
(defun corfu-next ()
"Go to next candidate."
(interactive)
- (corfu--goto (1+ corfu--index)))
+ (corfu--goto
+ (if (and corfu-cycle (= (1+ corfu--index) corfu--total))
+ -1
+ (1+ corfu--index))))
(defun corfu-previous ()
"Go to previous candidate."
(interactive)
- (corfu--goto (- corfu--index 1)))
+ (corfu--goto
+ (if (and corfu-cycle (< corfu--index 0))
+ (- corfu--total 1)
+ (- corfu--index 1))))
(defun corfu-scroll-down ()
"Go back by one page."
- [elpa] externals/corfu 7d3c6c4 07/29: README: Update features section, (continued)
- [elpa] externals/corfu 7d3c6c4 07/29: README: Update features section, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu a2de3f2 11/29: Adjust faces, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 5571d2b 13/29: Revert "Go back to e0198b4335add183e0673c2b224e3d6c3ac09cab for now", Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 4b32521 12/29: Go back to e0198b4335add183e0673c2b224e3d6c3ac09cab for now, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu f721f1b 14/29: Properly compute character size, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 247c79b 16/29: update screenshot, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 428ef03 08/29: post-command-hook: Make the check more strict, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu e0198b4 09/29: Simplify post-command behavior, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu a497acc 10/29: Experimental border images, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 17201cd 15/29: Generate image in PBM format, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu f98d239 02/29: Add support for cycling,
Stefan Monnier <=
- [elpa] externals/corfu ce983a0 17/29: README: Expand configuration, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 2f9e154 18/29: Use completion--replace, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 219afe2 21/29: Deactivate fancy border if line spacing is used (Fix #1), Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 5bacf55 20/29: Simplifications, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu e6bfd22 26/29: Add corfu-min-width, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu a61992d 29/29: Rework popup function, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu a5fd9ad 22/29: Simplifications, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 145481d 19/29: corfu-insert: Call :exit-function, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 171b305 23/29: README: Add caveats section, Stefan Monnier, 2021/04/16
- [elpa] externals/corfu 30126c4 27/29: Add support for annotation and affixation function, Stefan Monnier, 2021/04/16