whompmacs/whomp/whomp-completion.el

56 lines
2.1 KiB
EmacsLisp

;;
;; Completion packages
;;
;; company toggle
(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))
:group 'whomp-config)
;; Company and auto-complete configuration
(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
(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
(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
(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
(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."))
(message "W.H.O.M.P. Completion configuration complete.")
(provide 'whomp-completion)