summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Nguyen <james@jojojames.com>2022-04-13 22:50:36 -0400
committerJames Nguyen <james@jojojames.com>2022-04-13 22:50:36 -0400
commitceac1a9681cb47de35aa37d63532b1b92cd58b72 (patch)
treed71710b1ea0fe36b998465dae909aedb0fa7f57c
parent7d593ab2855c7a729642848c6e13b13998231791 (diff)
Add corfu (#552)
-rw-r--r--evil-collection.el1
-rw-r--r--modes/corfu/evil-collection-corfu.el62
2 files changed, 63 insertions, 0 deletions
diff --git a/evil-collection.el b/evil-collection.el
index 555814e..3f97b9a 100644
--- a/evil-collection.el
+++ b/evil-collection.el
@@ -127,6 +127,7 @@ This will bind additional find-* type commands, e.g. usages, assignments, etc.."
company
compile
consult
+ corfu
(custom cus-edit)
cus-theme
dashboard
diff --git a/modes/corfu/evil-collection-corfu.el b/modes/corfu/evil-collection-corfu.el
new file mode 100644
index 0000000..a211857
--- /dev/null
+++ b/modes/corfu/evil-collection-corfu.el
@@ -0,0 +1,62 @@
+;;; evil-collection-corfu.el --- Bindings for `corfu-mode' -*- lexical-binding: t -*-
+
+;; Copyright (C) 2022 James Nguyen
+
+;; Author: James Nguyen <james@jojojames.com>
+;; Maintainer: James Nguyen <james@jojojames.com>
+;; URL: https://github.com/emacs-evil/evil-collection
+;; Version: 0.0.1
+;; Package-Requires: ((emacs "27.1"))
+;; Keywords: evil, corfu, convenience, matching
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;; Bindings for `corfu-mode'.
+
+;;; Code:
+(require 'corfu nil t)
+(require 'evil-collection)
+
+(defgroup evil-collection-corfu nil
+ "Evil bindings for `corfu-mode'."
+ :group 'evil-collection)
+
+(defvar corfu-map)
+
+(defconst evil-collection-corfu-maps '(corfu-map))
+
+;;;###autoload
+(defun evil-collection-corfu-setup ()
+ "Set up `evil' bindings for `corfu'."
+ (evil-collection-define-key 'insert 'corfu-map
+ (kbd "C-n") 'corfu-next
+ (kbd "C-p") 'corfu-previous
+ (kbd "C-j") 'corfu-next
+ (kbd "C-k") 'corfu-previous
+ (kbd "M-j") 'corfu-next
+ (kbd "M-k") 'corfu-previous
+ (kbd "<escape>") 'corfu-quit)
+ (when evil-want-C-u-scroll
+ (evil-collection-define-key 'insert 'corfu-map
+ (kbd "C-u") 'corfu-scroll-up))
+ (when evil-want-C-d-scroll
+ (evil-collection-define-key 'insert 'corfu-map
+ (kbd "C-d") 'corfu-scroll-down))
+
+ (advice-add 'corfu--setup :after 'evil-normalize-keymaps)
+ (advice-add 'corfu--teardown :after 'evil-normalize-keymaps))
+
+(provide 'evil-collection-corfu)
+;;; evil-collection-corfu.el ends here