diff options
Diffstat (limited to 'custom')
-rw-r--r-- | custom/jao-custom-completion.el | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/custom/jao-custom-completion.el b/custom/jao-custom-completion.el index 4bffd6d..0c67fbb 100644 --- a/custom/jao-custom-completion.el +++ b/custom/jao-custom-completion.el @@ -122,6 +122,61 @@ (add-hook 'minibuffer-setup-hook #'corfu-in-minibuffer 1) (global-corfu-mode 1)) +;;; company +(use-package company + :ensure t + :custom ((company-backends '(company-capf + ;; company-bbdb + company-files + company-dabbrev + company-keywords)) + (company-global-modes '(not slack-message-buffer-mode + circe-channel-mode + telega-chat-mode)) + (company-format-margin-function nil) ;; #'company-text-icons-margin + (company-idle-delay 0.2) + (company-lighter "") + (company-lighter-base "") + (company-show-numbers nil) + (company-selection-wrap-around t) + (company-tooltip-limit 15) + (company-tooltip-align-annotations t) + (company-tooltip-offset-display 'lines)) ;; 'scrollbar + + :config + (defun jao-complete-at-point () + "Complete using company unless we're in the minibuffer." + (interactive) + (if (or (not company-mode) (window-minibuffer-p)) + (completion-at-point) + (company-manual-begin))) + + (defun jao-company-use-in-tab () + (global-set-key [remap completion-at-point] #'jao-complete-at-point) + (global-set-key [remap completion-symbol] #'jao-complete-at-point) + (global-set-key (kbd "M-TAB") #'jao-complete-at-point)) + + (jao-company-use-in-tab) + + :bind (:map company-active-map + + ("<tab>" . company-complete-common-or-cycle) + ("TAB" . company-complete-common-or-cycle) + + ("C-h" . company-show-doc-buffer) + ("M-." . company-show-location) + ("C-<return>" . company-complete-selection) + ([remap return] . company-abort) + ("RET" . company-abort) + + :filter (or (not (derived-mode-p 'eshell-mode)) + (company-explicit-action-p)) + ("<return>" . company-complete-selection) + ("RET" . company-complete-selection)) + :diminish) + +(unless (display-graphic-p) (global-company-mode 1)) + ;;; vertico (use-package vertico :ensure t |