From d4ae0ba744eaa05545f7935c4f3aeceae541812a Mon Sep 17 00:00:00 2001 From: Thanos Apollo Date: Sat, 9 Sep 2023 02:53:03 +0300 Subject: emacs(dev): Add corfu, orderless and dabbrev config --- .emacs.d/modules/thanos-dev.el | 46 ++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 13 deletions(-) (limited to '.emacs.d') diff --git a/.emacs.d/modules/thanos-dev.el b/.emacs.d/modules/thanos-dev.el index f711bba..90c29f4 100644 --- a/.emacs.d/modules/thanos-dev.el +++ b/.emacs.d/modules/thanos-dev.el @@ -28,16 +28,37 @@ ;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱┃┃ ;; ╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╱╰╯ ;;; Code: -(require 'company) - -(add-hook 'after-init-hook 'global-company-mode) -(define-key company-active-map (kbd "TAB") 'company-indent-or-complete-common) -(setq company-idle-delay - (lambda () (if (company-in-string-or-comment) nil 0.0))) - -(require 'company-box) -(add-hook 'company-mode-hook 'company-box-mode) -(setf company-box-icons-alist 'company-box-icons-images) +(require 'corfu) +(require 'orderless) +(require 'dabbrev) + +(setf dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'")) + +(defun orderless-fast-dispatch (word index total) + (and (= index 0) (= total 1) (length< word 4) + `(orderless-regexp . ,(concat "^" (regexp-quote word))))) + +(orderless-define-completion-style orderless-fast + (orderless-style-dispatchers '(orderless-fast-dispatch)) + (orderless-matching-styles '(orderless-literal orderless-regexp))) + +;; Corfu +(global-corfu-mode) +(corfu-popupinfo-mode) + +(setf corfu-mode t + corfu-auto t + corfu-auto-delay 0 + corfu-auto-prefix 2 + corfu-cycle t + completion-styles '(orderless-fast basic) + completion-cycle-threshold 3 + corfu-popupinfo-delay 0 + corfu-quit-at-boundary 'separator + corfu-quit-no-match t + corfu-preselect 'first + corfu-preview-current t + corfu-echo-mode t) (setq indent-tabs-mode nil) @@ -76,7 +97,6 @@ (add-to-list 'completion-styles 'initials t) (add-hook 'emacs-lisp-mode-hook #'rainbow-delimiters-mode) -(add-hook 'emacs-lisp-mode-hook #'company-mode) (add-hook 'emacs-lisp-mode-hook #'display-line-numbers-mode) ;; Disable checkdoc flycheck for org-src buffers @@ -86,9 +106,9 @@ ;; Common lisp (setf inferior-lisp-program "sbcl") (add-hook 'lisp-mode-hook #'rainbow-delimiters-mode) -(add-hook 'lisp-mode-hook #'company-mode) + +;; Scheme (add-hook 'scheme-mode-hook #'rainbow-delimiters-mode) -(add-hook 'scheme-mode-hook #'company-mode) ;; LSP config (defun thanos/lsp-mode-setup () -- cgit v1.2.3