Change to company

This commit is contained in:
Alexander Rosenberg 2024-07-15 17:50:25 -07:00
parent ef97ad7fa9
commit 9c0a9df549
Signed by: Zander671
GPG Key ID: 5FD0394ADBD72730
2 changed files with 71 additions and 36 deletions

View File

@ -140,3 +140,41 @@
;; (setq inferior-lisp-program "/usr/bin/sbcl") ;; (setq inferior-lisp-program "/usr/bin/sbcl")
;; :config ;; :config
;; (sly-symbol-completion-mode -1)) ;; (sly-symbol-completion-mode -1))
;; corfu (autocomplete)
;; (use-package corfu
;; :bind (("M-<tab>" . completion-at-point)
;; :map corfu-map
;; ("M-SPC" . corfu-insert-separator)
;; ("M-m" . my/corfu-move-to-minibuffer))
;; :init
;; (defun my/corfu-move-to-minibuffer ()
;; (interactive)
;; (when completion-in-region--data
;; (let ((completion-extra-properties corfu--extra)
;; completion-cycle-threshold completion-cycling)
;; (apply #'consult-completion-in-region completion-in-region--data))))
;; (setq corfu-cycle t
;; corfu-auto t
;; corfu-on-exact-match nil
;; completion-cycle-threshold nil)
;; (global-corfu-mode 1)
;; (corfu-popupinfo-mode 1)
;; :config
;; (add-to-list 'corfu-continue-commands #'my/corfu-move-to-minibuffer))
;; (use-package corfu-terminal
;; :init
;; (corfu-terminal-mode 1))
;; ;; cape (a bunch of capfs!)
;; (use-package cape
;; :bind (("C-c p" . cape-dabbrev)
;; ([remap dabbrev-expand] . cape-dabbrev)
;; ("C-c P" . cape-line)
;; ("C-c f" . cape-file))
;; :hook (text-mode . my/-cape-setup-text-mode)
;; :init
;; (defun my/-cape-setup-text-mode ()
;; (setq-local completion-at-point-functions
;; '(cape-dict cape-dabbrev)
;; corfu-auto nil)))

69
init.el
View File

@ -427,43 +427,40 @@ visual states."
(use-package embark-consult (use-package embark-consult
:hook (embark-collect-mode . consult-preview-at-point-mode)) :hook (embark-collect-mode . consult-preview-at-point-mode))
;; corfu (autocomplete) ;; company (in buffer auto-complete)
(use-package corfu (use-package company
:bind (("M-<tab>" . completion-at-point) :defer nil
:map corfu-map :bind (("M-TAB" . company-complete)
("M-SPC" . corfu-insert-separator) ("M-<tab>" . company-complete)
("M-m" . my/corfu-move-to-minibuffer)) ("C-c f" . company-files)
:init ([remap dabbrev-expand] . company-dabbrev)
(defun my/corfu-move-to-minibuffer () :map prog-mode-map
(interactive) ([remap company-dabbrev] . company-dabbrev-code))
(when completion-in-region--data :hook ((company-search-mode . my/-company-search-mode-add-lighter)
(let ((completion-extra-properties corfu--extra) (sh-mode . my/-company-setup-shell-mode))
completion-cycle-threshold completion-cycling)
(apply #'consult-completion-in-region completion-in-region--data))))
(setq corfu-cycle t
corfu-auto t
corfu-on-exact-match nil
completion-cycle-threshold nil)
(global-corfu-mode 1)
(corfu-popupinfo-mode 1)
:config :config
(add-to-list 'corfu-continue-commands #'my/corfu-move-to-minibuffer)) (defun my/-company-setup-shell-mode ()
(use-package corfu-terminal (setq-local company-backends '(company-files company-keywords
:init company-dabbrev-code)))
(corfu-terminal-mode 1)) (defun my/-company-search-mode-add-lighter ()
(if company-search-mode
;; cape (a bunch of capfs!) (cl-pushnew company-search-lighter global-mode-string :test 'equal)
(use-package cape (setq global-mode-string
:bind (("C-c p" . cape-dabbrev) (cl-delete company-search-lighter global-mode-string :test 'equal))))
([remap dabbrev-expand] . cape-dabbrev) (defun my/-company-set-completion-styles (oldfun &rest args)
("C-c P" . cape-line) (let ((completion-styles '(basic emacs21 flex)))
("C-c f" . cape-file)) (apply oldfun args)))
:hook (text-mode . my/-cape-setup-text-mode) (advice-add 'company-capf :around 'my/-company-set-completion-styles)
:init (setopt company-format-margin-function #'company-text-icons-margin)
(defun my/-cape-setup-text-mode () (setq company-transformers '(company-sort-by-occurrence))
(setq-local completion-at-point-functions (global-company-mode 1))
'(cape-dict cape-dabbrev) (use-package company-quickhelp
corfu-auto nil))) :bind (:map company-active-map
("M-h" . company-quickhelp-manual-begin))
:after company
:config
(company-quickhelp-mode 1)
(setopt company-quickhelp-delay nil))
;; xref ;; xref
(use-package xref (use-package xref