company-minimum-prefix-length 1
company-global-modes '(not)
company-lighter-base "(C)")
+ (setq company-backends '(company-capf
+ company-keywords
+ company-semantic
+ company-files
+ company-etags
+ company-elisp
+ company-clang
+ company-irony-c-headers
+ company-irony
+ company-jedi
+ company-cmake
+ company-ispell
+ company-yasnippet))
(global-company-mode 1)
:bind (:map company-active-map
("C-n" . company-select-next)
#+END_SRC
*** C/C++
#+BEGIN_SRC emacs-lisp
- (use-package company-c-headers
- :ensure t
- :config (progn
- (defun malb/ede-object-system-include-path ()
- "Return the system include path for the current buffer."
- (when ede-object
- (ede-system-include-path ede-object)))
-
- (setq company-c-headers-path-system
- #'malb/ede-object-system-include-path)
+(use-package company-c-headers
+ :ensure t
+ :config (progn
+ (defun malb/ede-object-system-include-path ()
+ "Return the system include path for the current buffer."
+ (when ede-object
+ (ede-system-include-path ede-object)))
- (add-to-list 'company-backends #'company-c-headers)))
+ (setq company-c-headers-path-system
+ #'malb/ede-object-system-include-path)))
#+END_SRC
*** Python
#+BEGIN_SRC emacs-lisp
-(use-package company-anaconda
+(use-package company-jedi
:ensure t
- :config (add-to-list 'company-backends #'company-anaconda))
+ :hook (python-mode . 'jedi:setup)
+ :config
+ (setq jedi:complete-on-dot t)
+ )
#+END_SRC
*** Perl
#+BEGIN_SRC emacs-lisp
)
)
#+END_SRC
+**** Bibtex
#+BEGIN_SRC emacs-lisp
(use-package company-bibtex
:ensure t
#+END_SRC
*** Shell
- #+BEGIN_SRC emacs-lisp
- (use-package company-shell
- :ensure t
- :config (progn
- (setq company-shell-modes '(sh-mode shell-mode))
- (add-to-list 'company-backends 'company-shell)))
- #+END_SRC
+#+BEGIN_SRC emacs-lisp
+(use-package company-shell
+ :ensure t
+ :config (progn
+ (setq company-shell-modes '(sh-mode shell-mode))
+ (add-to-list 'company-backends 'company-shell)))
+#+END_SRC
*** YaSnippet
- Add YasSippet support for all company backends. ([[https://github.com/syl20bnr/spacemacs/pull/179][source]])
+Add YasSippet support for all company backends. ([[https://github.com/syl20bnr/spacemacs/pull/179][source]])
- *Note:* Do this at the end of =company-mode= config.
+*Note:* Do this at the end of =company-mode= config.
- #+BEGIN_SRC emacs-lisp
- (defvar malb/company-mode/enable-yas t
- "Enable yasnippet for all backends.")
+#+BEGIN_SRC emacs-lisp
+(defvar malb/company-mode/enable-yas t
+ "Enable yasnippet for all backends.")
- (defun malb/company-mode/backend-with-yas (backend)
- (if (or (not malb/company-mode/enable-yas)
- (and (listp backend)
- (member 'company-yasnippet backend)))
- backend
- (append (if (consp backend) backend (list backend))
- '(:with company-yasnippet))))
+(defun malb/company-mode/backend-with-yas (backend)
+ (if (or (not malb/company-mode/enable-yas)
+ (and (listp backend)
+ (member 'company-yasnippet backend)))
+ backend
+ (append (if (consp backend) backend (list backend))
+ '(:with company-yasnippet))))
- (setq company-backends
- (mapcar #'malb/company-mode/backend-with-yas company-backends))
- #+END_SRC
+(setq company-backends
+ (mapcar #'malb/company-mode/backend-with-yas company-backends))
+#+END_SRC
*** All the words
- Enable/disable company completion from ispell dictionaries ([[https://github.com/redguardtoo/emacs.d/blob/master/lisp/init-company.el][source]])
+Enable/disable company completion from ispell dictionaries ([[https://github.com/redguardtoo/emacs.d/blob/master/lisp/init-company.el][source]])
- #+BEGIN_SRC emacs-lisp
- (defun malb/toggle-company-ispell ()
- (interactive)
- (cond
- ((member '(company-ispell :with company-yasnippet) company-backends)
- (setq company-backends (delete '(company-ispell :with company-yasnippet) company-backends))
- (add-to-list 'company-backends '(company-dabbrev :with company-yasnippet) t)
- (message "company-ispell disabled"))
- (t
- (setq company-backends (delete '(company-dabbrev :with company-yasnippet) company-backends))
- (add-to-list 'company-backends '(company-ispell :with company-yasnippet) t)
- (message "company-ispell enabled!"))))
-
- (defun malb/company-ispell-setup ()
- ;; @see https://github.com/company-mode/company-mode/issues/50
- (when (boundp 'company-backends)
- (make-local-variable 'company-backends)
- (setq company-backends (delete '(company-dabbrev :with company-yasnippet) company-backends))
- (add-to-list 'company-backends '(company-ispell :with company-yasnippet) t)
- ;; https://github.com/redguardtoo/emacs.d/issues/473
- (if (and (boundp 'ispell-alternate-dictionary)
- ispell-alternate-dictionary)
- (setq company-ispell-dictionary ispell-alternate-dictionary))))
- #+END_SRC
+#+BEGIN_SRC emacs-lisp
+(defun malb/toggle-company-ispell ()
+ (interactive)
+ (cond
+ ((member '(company-ispell :with company-yasnippet) company-backends)
+ (setq company-backends (delete '(company-ispell :with company-yasnippet) company-backends))
+ (add-to-list 'company-backends '(company-dabbrev :with company-yasnippet) t)
+ (message "company-ispell disabled"))
+ (t
+ (setq company-backends (delete '(company-dabbrev :with company-yasnippet) company-backends))
+ (add-to-list 'company-backends '(company-ispell :with company-yasnippet) t)
+ (message "company-ispell enabled!"))))
+
+(defun malb/company-ispell-setup ()
+ ;; @see https://github.com/company-mode/company-mode/issues/50
+ (when (boundp 'company-backends)
+ (make-local-variable 'company-backends)
+ (setq company-backends (delete '(company-dabbrev :with company-yasnippet) company-backends))
+ (add-to-list 'company-backends '(company-ispell :with company-yasnippet) t)
+ ;; https://github.com/redguardtoo/emacs.d/issues/473
+ (if (and (boundp 'ispell-alternate-dictionary)
+ ispell-alternate-dictionary)
+ (setq company-ispell-dictionary ispell-alternate-dictionary))))
+#+END_SRC
*** Tab DWIM
(elpy-enable)
)
#+END_SRC
-# *** Jedi
-# #+BEGIN_SRC emacs-lisp
-# (use-package company-jedi
-# :ensure t
-# :hook (python-mode . (add-to-list 'company-backends 'company-jedi))
-# :hook (python-mode . 'jedi:setup)
-# :config
-# (setq jedi:complete-on-dot t)
-# )
-# #+END_SRC
*** Black
#+begin_src emacs-lisp :tangle yes
(use-package python-black