;;; completion.el --- Completion base packages. -*- lexical-binding: t; -*- ;;; Commentary: ;; * Ivy ;; * Counsel ;;; Code: (require 'basics/package-management) (require 'basics/global-variables) (require 'basics/appearance) (require 'misc/libs) (require 'basics/input) ;; Completion in many Emacs commands. (use-package ivy :demand t :diminish ivy-mode :custom ((ivy-use-virtual-buffers t) (ivy-count-format "[%d/%d] ") (ivy-wrap t)) :config (ivy-mode 1) :bind (("C-c C-r" . ivy-resume) (:map ivy-minibuffer-map ("M-" . ivy-previous-history-element) ("M-" . ivy-next-history-element) ("S-" . ivy-immediate-done)))) ; Ignore completion. ;; Extensions for ivy (use-package counsel :demand t :after (ivy imenu) :bind (("C-x C-f" . counsel-find-file) ("M-x" . counsel-M-x) ("M-i" . counsel-imenu))) ;; More information in ivy mini-buffers. (use-package ivy-rich :demand t :after (counsel) :config (ivy-rich-mode 1)) ;; Use icons in ivy-rich. (use-package all-the-icons-ivy-rich :demand t :after (all-the-icons ivy-rich) :config (all-the-icons-ivy-rich-mode 1)) (use-package ivy-emoji ; Insert emojis with ivy. :after (ivy) :bind ("C-c e" . ivy-emoji)) ;; Sorting and filtering for ivy. (use-package ivy-prescient :after (prescient counsel) :custom (ivy-prescient-retain-classic-highlighting t) :hook (after-init . ivy-prescient-mode)) ;; C-o shows additional options. (use-package ivy-hydra :after (ivy)) ;; Autocompletion mode with many plugins. (use-package company :unless slow-computer :diminish company-mode :custom ((company-minimum-prefix-length 1) ; Suggestions after 1 character. (company-selection-wrap-around t) (company-tooltip-align-annotations t) ; Align to the right border. (company-idle-delay 0.5)) :bind (:map company-active-map ("" . nil) ; Disable completion on return. ("RET" . nil) ; https://emacs.stackexchange.com/a/13290 ("" . company-complete-selection) ; Make tab work in lists. ("TAB" . company-complete-selection)) ; Tab in terminals. :hook (after-init . global-company-mode)) ;; Documentation popups for completions. (use-package company-quickhelp :after (company) :config (company-quickhelp-mode)) ;; Sorting and filtering for company. (use-package company-prescient :after (prescient company) :config (defun my/company-prescient-sort-length-off () "Turn off length-based sorting. Desirable when another intelligent sorting algorithm is at work." (setq-local company-prescient-sort-length-enable nil)) :hook (company-mode . company-prescient-mode)) (provide 'misc/completion) ;;; completion.el ends here