From e4aae6eba1b337194295ce544e453d045ef1b62b Mon Sep 17 00:00:00 2001 From: jao Date: Fri, 30 Apr 2021 23:00:23 +0100 Subject: it's company for now --- completion.org | 75 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 62 insertions(+), 13 deletions(-) (limited to 'completion.org') diff --git a/completion.org b/completion.org index 4f5787c..7a88913 100644 --- a/completion.org +++ b/completion.org @@ -13,30 +13,79 @@ (use-package orderless :ensure t :init - (setq completion-styles '(orderless) - orderless-skip-highlighting t + (setq orderless-skip-highlighting t orderless-component-separator "[ -/]+" orderless-matching-styles '(orderless-literal orderless-regexp orderless-initialism))) #+end_src -* corfu and dabbrev +* company #+begin_src emacs-lisp + (use-package company + :ensure t + :custom ((company-backends '(company-capf + company-bbdb + company-files + company-dabbrev + company-keywords)) + ;; (company-global-modes '(clojure-mode)) + ;; (company-global-modes t) + (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 (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 + + ("" . #'company-complete-common-or-cycle) + ("TAB" . #'company-complete-common-or-cycle) + + ("C-h" . #'company-show-doc-buffer) + ("M-." . #'company-show-location) + + :filter (or (not (derived-mode-p 'eshell-mode)) + (company-explicit-action-p)) + ("" . #'company-complete-selection) + ("RET" . #'company-complete-selection)) + :diminish) + + (global-company-mode 1) + #+end_src +* corfu and dabbrev + #+begin_src emacs-lisp :load no (jao-load-path "corfu") (use-package corfu :init (setq corfu-cycle t - corfu-excluded-modes nil) + corfu-excluded-modes '(clojure-mode)) - :config (corfu-global-mode) + :config + ;; (corfu-global-mode) + (use-package dabbrev + ;; Swap M-/ and C-M-/ + :bind (("M-/" . dabbrev-completion) + ("C-M-/" . dabbrev-expand))) :bind (:map corfu-map ("TAB" . corfu-next) ("S-TAB" . corfu-previous))) - (use-package dabbrev - ;; Swap M-/ and C-M-/ - :bind (("M-/" . dabbrev-completion) - ("C-M-/" . dabbrev-expand))) #+end_src * vertico #+begin_src emacs-lisp @@ -47,9 +96,9 @@ :init (setq vertico-count 20) :config - ;; (defun jao--be-orderless (&rest _any) - ;; (setq-local completion-styles '(orderless))) - ;; (advice-add 'vertico--setup :before #'jao--be-orderless) + (defun jao--be-orderless (&rest _any) + (setq-local completion-styles '(orderless))) + (advice-add 'vertico--setup :before #'jao--be-orderless) (vertico-mode)) #+end_src * marginalia @@ -115,7 +164,7 @@ #'consult-narrow-help)) #+end_src *** notmuch - #+begin_src emacs-lisp + #+begin_src emacs-lisp :load no (jao-load-path "consult-notmuch") (use-package consult-notmuch :config -- cgit v1.2.3