60 lines
1.6 KiB
EmacsLisp
60 lines
1.6 KiB
EmacsLisp
;;; earnecore-company.el --- Company completion -*- lexical-binding: t; -*-
|
|
|
|
;; Copyright (C) 2020-2021 earnest ma
|
|
;; SPDX-License-Identifier: MIT
|
|
;; Author: earnest ma <me@earne.link>
|
|
|
|
;;; Code:
|
|
(use-package company
|
|
:init (global-company-mode)
|
|
:bind (:map company-active-map
|
|
;; TAB should always complete the current selection
|
|
("<tab>" . company-complete-selection)
|
|
|
|
;; Spaces should not try to complete
|
|
("SPC" . nil))
|
|
|
|
:bind ((;; Trigger completion manually
|
|
"M-RET" . company-manual-begin))
|
|
|
|
:config
|
|
;; Max number of results
|
|
(setq company-tooltip-limit 10)
|
|
|
|
;; Press M-# to complete that selection
|
|
(setq company-show-numbers t)
|
|
|
|
;; Show results immediately/ faster
|
|
(setq company-idle-delay 0)
|
|
(setq company-echo-delay 0)
|
|
(setq company-minimum-prefix-length 2)
|
|
|
|
;; Prevent non-matching input from blocking, but only if we explicitly
|
|
;; interact with company
|
|
(setq company-require-match #'company-explicit-action-p)
|
|
|
|
;; Do not downcase completion suggestions
|
|
(setq company-dabbrev-downcase nil))
|
|
|
|
(use-package company-statistics
|
|
:demand
|
|
:after company
|
|
:config
|
|
;; Load the company-statistics file silently.
|
|
(defun earnemacs--company-statistics--load ()
|
|
"Restore statistics without a minibuffer message"
|
|
(load company-statistics-file 'noerror 'nomessage 'nosuffix))
|
|
(advice-add 'company-statistics--load
|
|
:override #'earnemacs--company-statistics--load)
|
|
|
|
;; Load
|
|
(company-statistics-mode))
|
|
|
|
(use-package company-quickhelp
|
|
:demand
|
|
:after company
|
|
:config (company-quickhelp-mode))
|
|
|
|
(provide 'earnemod-company)
|
|
;;; earnemod-company.el ends here
|