Skip to content

Latest commit

 

History

History
146 lines (117 loc) · 5.94 KB

README.org

File metadata and controls

146 lines (117 loc) · 5.94 KB

:completion company

Description

This module provides code completion, powered by company-mode. Many of Doom’s doom-module::lang modules require it for “intellisense” functionality.

https://assets.doomemacs.org/completion/company/overlay.png

Maintainers

  • @hlissner

Become a maintainer?

Module flags

+childframe
Display completion candidates in a child frame rather than an overlay or tooltip. Requires GUI Emacs.
+tng
Invoke completion on TAB instad of C-SPC. When company is active, TAB and S-TAB will navigate the completion candidates.

Packages

  • doom-package:company-box if doom-module:+childframe
  • doom-package:company-dict
  • doom-package:company-mode

Hacks

No hacks documented for this module.

Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module has no direct requirements, but some languages may have their own requirements to fulfill before you get code completion in them (and some languages may lack code completion support altogether). Run $ doom doctor to find out if you’re missing any dependencies.

Usage

󱌣 This module’s usage documentation is incomplete. Complete it?

Code completion

By default, completion is triggered after a short idle period or with the C-SPC key. While the popup is visible, the following keys are available:

KeybindDescription
C-nGo to next candidate
C-pGo to previous candidate
C-j(evil) Go to next candidate
C-k(evil) Go to previous candidate
C-hDisplay documentation (if available)
C-uMove to previous page of candidates
C-dMove to next page of candidates
C-sFilter candidates
C-S-sSearch candidates with helm/ivy
C-SPCComplete common
TABComplete common or select next candidate
S-TABSelect previous candidate

Vim-esque omni-completion prefix (C-x)

In the spirit of Vim’s omni-completion, the following insert mode keybinds are available to evil users to access specific company backends:

KeybindDescription
C-x C-​]Complete etags
C-x C-fComplete file path
C-x C-kComplete from dictionary/keyword
C-x C-lComplete full line
C-x C-oInvoke complete-at-point function
C-x C-nComplete next symbol at point
C-x C-pComplete previous symbol at point
C-x C-sComplete snippet
C-x sComplete spelling suggestions

Searching with multiple keywords

If the vertico module is enabled, users can perform code completion with multiple search keywords with an ampersand &. More information can be found here.

Configuration

󱌣 This module’s configuration documentation is incomplete. Complete it?

Enable company backend(s) in certain modes

The set-company-backend! function exists for setting company-backends buffer-locally in MODES, which is either a major-mode symbol, a minor-mode symbol, or a list of either. BACKENDS are prepended to company-backends for those modes.

(after! js2-mode
  (set-company-backend! 'js2-mode 'company-tide 'company-yasnippet))

(after! sh-script
  (set-company-backend! 'sh-mode
    '(company-shell :with company-yasnippet)))

(after! cc-mode
  (set-company-backend! 'c-mode
    '(:separate company-irony-c-headers company-irony)))

To unset the backends for a particular mode, pass nil to it:

(after! sh-script
  (set-company-backend! 'sh-mode nil))

Troubleshooting

Report an issue?

X-mode doesn’t have code completion support or requires extra setup

There is no guarantee your language mode will have completion support.

Some, like lua-mode, don’t have completion support in Emacs at all. Others may requires additional setup to get code completion working. For instance, go-mode requires guru to be installed on your system, and ruby-mode requires that you have a Robe server running (M-x robe-start).

Check the relevant module’s documentation for this kind of information.

No backends (or the incorrect ones) have been registered for X-mode

Doom expects every mode to have an explicit list of company-backends (and as short a list as possible). This may mean you aren’t getting all the completion you want or any at all.

Check the value of company-backends (SPC h v company-backends) from that mode to see what backends are available. Check the Configuration section for details on changing what backends are available for that mode.

Frequently asked questions

This module has no FAQs yet. Ask one?

Appendix

󱌣 This module has no appendix yet. Write one?