whompmacs/whomp/whomp-completion.el

56 lines
2.1 KiB
EmacsLisp
Raw Normal View History

;;
;; Completion packages
;;
;; company toggle
2024-07-12 23:32:01 +00:00
(defcustom whomp-completion nil
"Choose the completion framework to use."
:type '(choice (const :tag "None" nil)
(const :tag "company" companycomp)
(const :tag "helm" helmcomp)
(const :tag "ivy" ivycomp))
2024-07-12 23:32:01 +00:00
:group 'whomp-config)
;; Company and auto-complete configuration
2024-07-12 23:32:01 +00:00
(when (and (eq 'companycomp whomp-completion) (not (eq 'helmcomp whomp-completion)) (not (eq 'ivycomp whomp-completion)))
(straight-use-package 'company)
(add-hook 'after-init-hook 'global-company-mode)
(message "Company completion enabled."))
;; If ivy is enabled, install and configure it
2024-07-12 23:32:01 +00:00
(when (and (eq 'ivycomp whomp-completion) (not (eq 'companycomp whomp-completion)) (not (eq 'helmcomp whomp-completion)))
(straight-use-package 'ivy)
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(message "Ivy completion enabled."))
;; If helm is enabled, install and configure it
2024-07-12 23:32:01 +00:00
(when (and (eq 'helmcomp whomp-completion) (not (eq 'companycomp whomp-completion)) (not (eq 'ivycomp whomp-completion)))
(straight-use-package 'helm)
(helm-mode 1)
(message "Helm completion enabled."))
;; If all are enabled, choose company
2024-07-12 23:32:01 +00:00
(when (or (and (eq 'companycomp whomp-completion) (eq 'helmcomp whomp-completion) (eq 'ivycomp whomp-completion))
(and (eq 'companycomp whomp-completion) (eq 'helmcomp whomp-completion) (not (eq 'ivycomp whomp-completion)))
(and (eq 'companycomp whomp-completion) (eq 'ivycomp whomp-completion) (not (eq 'helmcomp whomp-completion))))
(straight-use-package 'company)
(add-hook 'after-init-hook 'global-company-mode)
(message "There can be only one. Company completion picked."))
;; if helm and ivy are enabled, choose ivy
2024-07-12 23:32:01 +00:00
(when (and (eq 'helmcomp whomp-completion) (eq 'ivycomp whomp-completion) (not (eq 'companycomp whomp-completion)))
(straight-use-package 'ivy)
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(setq enable-recursive-minibuffers t)
(message "There can be only one. Ivy completion picked."))
2024-07-12 23:32:01 +00:00
(message "W.H.O.M.P. Completion configuration complete.")
(provide 'whomp-completion)