summary refs log tree commit diff stats
path: root/user/emacs/init.el
diff options
context:
space:
mode:
Diffstat (limited to 'user/emacs/init.el')
-rw-r--r--user/emacs/init.el82
1 files changed, 31 insertions, 51 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index 9317968a..279fd4b0 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -404,7 +404,8 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
   :demand t
   :config (progn
             (setq evil-collection-magit-use-y-for-yank nil
-                  evil-collection-want-company-extended-keybindings t)
+                  evil-collection-corfu-key-themes '(tab-n-go
+                                                     magic-return))
             (general-unbind 'normal magit-mode-map
               "<escape>")
             (evil-collection-init)))
@@ -520,48 +521,38 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
 
 ;;; Completion
 
-(use-package company
-  :defer 2
-  :commands (company-explicit-action-p)
+(use-package corfu
+  :defer 1
   :config (progn
-            (setq company-idle-delay 0.2
-                  company-tooltip-align-annotations t
-                  company-show-quick-access t
-                  company-dabbrev-downcase nil
-                  company-dabbrev-ignore-case nil
-                  company-begin-commands '(self-insert-command)
-                  company-insertion-on-trigger #'company-explicit-action-p
-                  company-insertion-triggers '(?\ ?\( ?\) ?.))
-            (global-company-mode +1))
-  :general
-  (:states 'insert
-           "TAB" #'company-indent-or-complete-common
-           "C-x C-f" #'company-files)
-  (:keymaps 'company-active-map
-            "TAB" #'company-complete-common-or-cycle
-            "<tab>" #'company-complete-common-or-cycle
-            "C-j" nil
-						"<M-tab>" #'company-other-backend
-						"<C-tab>" #'company-other-backend
-            "S-TAB" #'company-select-previous
-            "<backtab>" #'company-select-previous))
-
-(use-package company-posframe
-  :after company
+            (global-corfu-mode +1)
+            (setq corfu-auto t
+                  corfu-auto-delay 0.1
+                  corfu-auto-prefix 3)
+            (defun corfu-enable-in-minibuffer ()
+              "Enable Corfu in the minibuffer if `completion-at-point' is bound."
+              (when (where-is-internal #'completion-at-point (list (current-local-map)))
+                (setq-local corfu-auto nil) ;; Enable/disable auto completion
+                (setq-local corfu-echo-delay nil ;; Disable automatic echo and popup
+                            corfu-popupinfo-delay nil)
+                (corfu-mode 1)))
+            (add-hook 'minibuffer-setup-hook #'corfu-enable-in-minibuffer)
+            (add-hook 'eshell-mode-hook (lambda ()
+                                          (setq-local corfu-auto nil)
+                                          (corfu-mode +1)))))
+
+(use-package cape
+  :after (corfu)
+  :general (:states 'insert
+                    "c-x c-f" #'cape-file))
+
+(use-package kind-icon
+  :after (corfu)
   :config (progn
-            (when (display-graphic-p)
-              (company-posframe-mode +1))))
-
-(use-package company-shell
-  :after company
-  :config (progn
-            (setq company-shell-clean-manpage t)
-            (add-to-list 'company-backends '(company-shell company-shell-env))))
+            (setq kind-icon-default-face 'corfu-default)
+            (add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter)))
 
 (use-package tabnine
-  :after (company)
   :config (progn
-            (delq 'company-preview-if-just-one-frontend company-frontends)
             (setq tabnine-binaries-folder "~/.local/tabnine")
             (global-tabnine-mode)
 
@@ -680,14 +671,6 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
   :commands (eshell-toggle)
   :general ("C-`" #'eshell-toggle))
 
-(use-package capf-autosuggest
-  :after eshell
-  :general (:keymaps 'capf-autosuggest-active-mode-map
-                     "C-e" #'capf-autosuggest-end-of-line
-                     "<right>" #'capf-autosuggest-end-of-line)
-  :ghook ('(eshell-mode-hook
-            comint-mode-hook)))
-
 (declare-function eshell-push-command "esh-buf-stack" (CMD))
 (defun my-bind-esh-push ()
   (general-define-key
@@ -1045,7 +1028,6 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
             haskell-mode-hook)
           #'eglot-ensure)
   :config (progn
-						(add-to-list 'eglot-stay-out-of 'company)
             (defun my/setup-eglot-eldoc ()
               (push 'flymake-eldoc-function eldoc-documentation-functions))
             (add-hook 'eglot-managed-mode-hook 'my/setup-eglot-eldoc)
@@ -1066,12 +1048,10 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
   :ghook ('(feature-mode-hook js2-mode-hook json-mode-hook typescript-mode-hook) #'add-node-modules-path))
 
 (use-package tide
-  :after (typescript-mode company flycheck)
+  :after (typescript-mode flycheck)
   :ghook ('typescript-mode-hook #'tide-setup)
   :init (progn
-          (setq tide-completion-setup-company-backend nil)
-          (flycheck-add-next-checker 'javascript-tide 'javascript-eslint)
-          (company-set-secondary-backend-for-mode typescript-mode 'company-tide)))
+          (flycheck-add-next-checker 'javascript-tide 'javascript-eslint)))
 
 ;;;; Reformat on save