This simple company backend emulates ac-source-dictionary
and vim's
dictionary omnicompletion (C-x C-k
). It's much like company-keywords
, but
with lazy-loaded dictionary files, and support for annotations and
documentation.
- It is meant as an alternative to
company-keywords
. - A dictionary is a plaintext file named after the major-mode in which it should be active.
- The dictionary file
all
applies to all modes. - This file is a newline-delimited list of keywords.
- Each keyword is tab-delimited in the following format:
[keyword] [[annotation] [documentation]]
M-x package-install RET company-dict
(require 'company-dict)
;; Where to look for dictionary files. Default is ~/.emacs.d/dict
(setq company-dict-dir (concat user-emacs-directory "dict/"))
;; Optional: if you want it available everywhere
(add-to-list 'company-backends 'company-dict)
;; Optional: evil-mode users may prefer binding this to C-x C-k for vim
;; omni-completion-like dictionary completion
(define-key evil-insert-state-map (kbd "C-x C-k") 'company-dict)
Add minor mode symbols to company-dict-minor-mode-list
to make company-dict
aware of minor mode dictionaries.
company-dict
autocompletions are automatically expanded like they're
yasnippet snippets if yasnippet is installed and yas-minor-mode
is
enabled in the current buffer.
Yasnippet is not a dependency of company-dict, so you must install and enable it
yourself. Which can be done through MELPA: M-x package-install RET yasnippet
To disable this behavior, set company-dict-enable-yasnippet
to nil
company-dict-minor-mode-alist
company-dict-dir
company-dict-minor-mode-alist
company-dict-enable-fuzzy
company-dict-enable-yasnippet