Use company-dabbrev-code in prog-modes & company-dabbrev everywhere else

This commit is contained in:
Henrik Lissner 2018-05-28 00:08:14 +02:00
parent 376adde0d8
commit 5b31fd9505
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 12 additions and 2 deletions

View file

@ -16,6 +16,16 @@
(= company-candidates-length 1))
(company-complete-common)))
;;;###autoload
(defun +company/dabbrev ()
"Invokes `company-dabbrev-code' in prog-mode buffers and `company-dabbrev'
everywhere else."
(interactive)
(call-interactively
(if (derived-mode-p 'prog-mode)
#'company-dabbrev-code
#'company-dabbrev)))
;;;###autoload
(defun +company/whole-lines (command &optional arg &rest ignored)
"`company-mode' completion backend that completes whole-lines, akin to vim's
@ -49,5 +59,5 @@ C-x C-l."
(interactive)
(require 'company-dabbrev)
(let ((company-selection-wrap-around t))
(call-interactively #'company-dabbrev-code)
(call-interactively #'+company/dabbrev)
(company-select-previous-or-abort)))