You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

4.0 KiB

UI - Completion

Package

Define UI completion package.

  (use-package emacs
    :after uno-ui
    :config
    (provide 'uno-ui-completion))

Vertico

  (use-package vertico
    :after uno-ui-completion
    :custom
    (enable-recursive-minibuffers t)
    (minibuffer-prompt-properties '(read-only
                                    t
                                    cursor-intangible
                                    t
                                    face
                                    minibuffer-prompt))
    (vertico-cycle t)
    :hook
    (minibuffer-setup . cursor-intangible-mode)
    :general
    (vertico-map
     "<escape>" 'abort-recursive-edit
     "C-j" 'vertico-next
     "C-k" 'vertico-previous)
    :init
    (defun crm-indicator (args)
      (cons (concat "[CRM] " (car args)) (cdr args)))
    (advice-add 'completing-read-multiple :filter-args 'crm-indicator)
    (vertico-mode 1))

  (use-package orderless
    :after (uno-ui-completion vertico)
    :custom
    (completion-category-defaults nil)
    (completion-category-overrides '((file (styles . (partial-completion)))))
    (completion-styles '(substring orderless)))

  (use-package savehist
    :after (uno-ui-completion vertico)
    :custom
    (savehist-file (uno-cache-path "savehist"))
    :config
    (savehist-mode 1))

Consult

Enhance completion.

  (use-package consult
    :after uno-ui-completion
    :custom
    (register-preview-delay 0)
    (register-preview-function 'consult-register-format)
    (xref-show-xrefs-function 'consult-xref)
    (xref-show-definitions-function 'consult-xref)
    :hook
    (completion-list-mode . consult-preview-at-point-mode)
    :general
    (uno-leader-define
      "bb" '(consult-buffer :which-key "Switch buffer")))

  (use-package consult
    :after (uno-ui-completion projectile)
    :custom
    (consult-project-root-function 'projectile-project-root))

Ripgrep Integration

Integrate for searching capabilities.

  (use-package ripgrep
    :after uno-ui-completion
    :if (executable-find "rg"))

  (use-package consult
    :after (uno-ui-completion ripgrep)
    :general
    (uno-leader-define
      "/" '(consult-ripgrep :which-key "Search files")))

Company

Text completion framework.

  (use-package company
    :after uno-ui-completion
    :custom
    (company-idle-delay 0)
    (company-minimum-prefix-length 2)
    (company-tooltip-limit 14)
    (company-tooltip-align-annotations t)
    (company-require-match 'never)
    :hook
    (company-mode . evil-normalize-keymaps)
    (uno-prog-mode . uno/ui/completion/company)
    :init
    (defun uno/ui/completion/company ()
      "Set up company-mode."
      (company-mode 1)))

Help

Enable help tooltip for company.

  (use-package company-quickhelp
    :after (uno-ui-completion company)
    :custom
    (register-preview-delay 0)
    (register-preview-function 'consult-register-format)
    (xref-show-xrefs-function 'consult-xref)
    (xref-show-definitions-function 'consult-xref)
    :hook
    (company-mode . company-quickhelp-local-mode)
    :config
    (delq 'company-echo-metadata-frontend company-frontends))

Icons

Front-end for company GUI.

  (use-package company-box
    :after (uno-ui-completion company)
    :if (display-graphic-p)
    :custom
    (company-box-backends-colors nil)
    (company-box-max-candidates 50)
    (company-box-show-single-candidate t)
    :hook
    (company-mode . company-box-mode)
    :config
    (delq 'company-echo-metadata-frontend company-frontends))

Usage History

  (use-package company-statistics
    :after (uno-ui-completion company)
    :custom
    (company-statistics-file (uno-cache-path "company/statistics.el"))
    :hook
    (company-mode . company-statistics-mode))