This module provides code completion, powered by company-mode. It is required for code completion in many of Doom’s :lang modules.
This module has no dedicated maintainers. Become a maintainer?
1.2. Module flags
- Enables displaying completion candidates in a child frame, rather than an overlay or tooltip (among with other UI enhancements). Incompatible with +tng.
- Enables completion using only TAB. Pressing TAB will select the next completion suggestion, while S-TAB will select the previous one. Incompatible with +childframe.
No hacks documented for this module.
This module has no direct prerequisites, but some major modes may require additional setup for code completion, and other major modes may have no completion support at all. Check that major mode’s module’s documentation for details.
3.1. 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:
|C-n||Go to next candidate|
|C-p||Go to previous candidate|
|C-j||(evil) Go to next candidate|
|C-k||(evil) Go to previous candidate|
|C-h||Display documentation (if available)|
|C-u||Move to previous page of candidates|
|C-d||Move to next page of candidates|
|C-S-s||Search candidates with helm/ivy|
|TAB||Complete common or select next candidate|
|S-TAB||Select previous candidate|
3.2. 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:
|C-x C-]||Complete etags|
|C-x C-f||Complete file path|
|C-x C-k||Complete from dictionary/keyword|
|C-x C-l||Complete full line|
|C-x C-o||Invoke complete-at-point function|
|C-x C-n||Complete next symbol at point|
|C-x C-p||Complete previous symbol at point|
|C-x C-s||Complete snippet|
|C-x s||Complete spelling suggestions|
4.1. Enable Company backend(s) in certain modes
set-company-backend! function exists for setting
buffer-locally in MODES, which is either a major-mode symbol, a minor-mode
symbol, or a list of either. BACKENDS are prepended to
(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:
If code completion isn’t working for you, consider the following common causes before you file a bug report:
X-mode doesn’t have code completion support or requires extra setup.
There is no guarantee your language mode will have completion support.
lua-mode, don’t have completion support in Emacs at all. Others may
requires additional setup to get code completion working. For instance,
guru to be installed on your system, and
requires that you have a Robe server running (
Check the relevant module’s documentation for this kind of information.
5.2. No backends (or the incorrect ones) have been registered for
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 (<help> 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.
6. TODO Appendix
This module has no appendix yet. Write one?