85 lines
2.5 KiB
EmacsLisp
85 lines
2.5 KiB
EmacsLisp
;;; 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)
|
|
|
|
;; 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-<up>" . ivy-previous-history-element)
|
|
("M-<down>" . ivy-next-history-element)
|
|
("S-<return>" . 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))
|
|
|
|
;; 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
|
|
("<return>" . nil) ; Disable completion on return.
|
|
("RET" . nil) ; https://emacs.stackexchange.com/a/13290
|
|
("<tab>" . 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)
|
|
:hook (after-init . company-prescient-mode))
|
|
|
|
(provide 'misc/completion)
|
|
;;; completion.el ends here
|