2
I had the same problem and what helped me was this config proposal from the Readme of the prettier-emacs mode:
https://github.com/prettier/prettier-emacs#usage-with-web-mode
You can declare a function "enable-minor-mode" in your .emacs-file:
(defun enable-minor-mode (my-pair)
"Enable minor mode if filename match the regexp. MY-PAIR is a cons cell (...
2
company-capf is the backend which should interface to mode's completion support in emacs versions >= 26
In addtion, look into using lsp and using the company-lsp backend.
Instructions for installing css helpers are here:
https://github.com/emacs-lsp/lsp-mode
Specifically:-
npm install -g vscode-css-languageserver-bin
2
Looks like you are using a variable-width font, not a fixed-width font, for those menu items. Find out which Emacs face is used for Company menu items, and change its font to a fixed-width font by using M-x customize-face.
I don't use Company, but a quick look at company-template.el, which is where its faces are defined, suggests that maybe the face you ...
1
In your setting of company-backends, don't use company-dabbrev in that group, use company-dabbrev-code.
1
Ok so this does the trick (disabling company mode on remote shells):
How can I disable company-mode in a shell when it is remote?
(defun my-shell-mode-setup-function ()
(when (and (fboundp 'company-mode)
(file-remote-p default-directory))
(company-mode -1)))
(add-hook 'shell-mode-hook 'my-shell-mode-setup-function)
1
By default company-mode doesn't seems to have that feature, BUT there is a package called company-box that take care of the documentation among other things:
Without company-box:
With company-box:
(To trigger the doc, you may have to wait like a second)
1
Firstly, (make-local-variable 'company-backends) is outdated, with newest company and other packages, we only need to set one global company-backends.
That's because all backends do check whether it's the right major-mode etc. for it to take responsibility. In other words, company-slime checks whether it's in common lisp code, and step out of the way if not, ...
1
Quite an ugly (and untested) suggestion:
Define an ad-hoc function:
(defun company-abort-and-insert-space ()
(interactive)
(company-abort)
(insert " "))
Replace
(define-key company-active-map (kbd "SPC") #'company-abort)
by
(define-key company-active-map (kbd "SPC") #'company-abort-and-insert-space)
in your init.el file.
1
company comes with a variable called company-global-modes. The docstring says:
Modes for which company-mode mode is turned on by
global-company-mode. If nil, means no modes. If t, then all major
modes have it turned on. If a list, it should be a list of
major-mode symbol names for which company-mode should be
automatically turned on. The sense ...
1
If you want to use company-mode in a few major modes, use a hook.
;; turn on company mode for all modes derived from prog-mode, and cmake-mode
(add-hook 'prog-mode-hook 'company-mode)
(add-hook 'cmake-mode-hook 'company-mode)
If you want to disable company-mode in a few major modes, use a hook.
;; enable company-mode everywhere except text-mode and cmake-...
1
Yes, it is possible. I use the following.
(setq company-ispell-available t)
(setq company-ispell-dictionary "/path/to/your/wordlist/file")
(add-to-list 'company-backends 'company-ispell)
The other answers are valid alternatives, here we are passing a custom-populated file to company to help auto-complete.
1
I suppose you use company's backend company-ispell to input plain words,
Insert below code into your ~/.emacs.d/init.el,
(defvar my-ispell-words
'("helle1"
"helle2"
"word1"
"word2"))
(defadvice ispell-lookup-words (after ispell-lookup-words-after-hack activate)
(let* ((word (car (ad-get-args 0)))
(my-words (all-completions word my-...
1
Can't give you an answer regarding Company, but I would assume that it provides that possibility.
Otherwise, the built-in, old but still very useful library completion.el offers that possibility. From the doc (which is only in the file's Commentary section):
;; SAVING/LOADING COMPLETIONS
;; Completions are automatically saved from one session to ...
Only top voted, non community-wiki answers of a minimum length are eligible