I use company when coding. I currently have it set to global. I would like to turn it off for a few major modes.

However, instead of turning it off globally, I only want to deactivate company for 2 or 3 modes.

I know I can use (add-hook 'mode 'somthing)

but, what do I need to put as the second argument to add-hook to turn off company?


1 Answer 1


From the documentation of company-mode (C-h f company-mode)

This is a minor mode. If called interactively, toggle the ‘Company mode’ mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

So, we use a hook

  ;; enable company in all prog-mode based modes
  (add-hook 'prog-mode-hook 'company-mode)
  ;; disable company in python-mode
  (add-hook 'python-mode-hook (lambda() (company-mode 0)))

Not the answer you're looking for? Browse other questions tagged or ask your own question.