emacs-company-dict
emacs-company-dict copied to clipboard
A port of ac-source-dictionary to company-mode, plus annotation and documentation support.
Company Dictionary
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
allapplies to all modes. - This file is a newline-delimited list of keywords.
- Each keyword is tab-delimited in the following format:
[keyword] [[annotation] [documentation]]- e.g.
os.path.basename [function] Return the base name of pathname path 
- NOTE: the parser squashes multiple tab characters, so use as many tabs as you'd like to organize your dictionary files.
- e.g.
Installation
M-x package-install RET company-dict
Usage
(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.
Yasnippet integration
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
Configuration
company-dict-minor-mode-alistcompany-dict-dircompany-dict-minor-mode-alistcompany-dict-enable-fuzzycompany-dict-enable-yasnippet