Complete overhaul of corfu configuration and completion in general
This commit is contained in:
parent
be0251eea8
commit
274d01a0e3
@ -680,77 +680,40 @@ Return nil if DIR is not in a hugo project at all."
|
|||||||
;; :custom ;(company-require-match nil)
|
;; :custom ;(company-require-match nil)
|
||||||
;; (company-tooltip-align-annotations t)
|
;; (company-tooltip-align-annotations t)
|
||||||
;; :hook (prog-mode . company-mode))
|
;; :hook (prog-mode . company-mode))
|
||||||
;; (use-package company-lsp
|
|
||||||
;; :after (lsp company)
|
|
||||||
;; :config
|
|
||||||
;; (push 'company-lsp company-backends))
|
|
||||||
;; (use-package company-fuzzy
|
|
||||||
;; :diminish
|
|
||||||
;; :hook (company-mode . company-fuzzy-mode)
|
|
||||||
;; ;; :init
|
|
||||||
;; :custom
|
|
||||||
;; ;; (company-fuzzy-sorting-backend 'flx)
|
|
||||||
;; (company-fuzzy-prefix-on-top nil)
|
|
||||||
;; (company-fuzzy-history-backends '(company-yasnippet))
|
|
||||||
;; (company-fuzzy-trigger-symbols '("." "->" "<" "\"" "'" "@"))
|
|
||||||
;; (company-fuzzy-passthrough-backends '(company-capf)))
|
|
||||||
(use-package bash-completion
|
|
||||||
:after eshell
|
|
||||||
:config
|
|
||||||
(defun bash-completion-from-eshell ()
|
|
||||||
(interactive)
|
|
||||||
(let ((completion-at-point-functions '(bash-completion-eshell-capf)))
|
|
||||||
(completion-at-point)))
|
|
||||||
(defun bash-completion-eshell-capf ()
|
|
||||||
(bash-completion-dynamic-complete-nocomint
|
|
||||||
(save-excursion (eshell-bol) (point)) (point) t))
|
|
||||||
:general (general-define-key
|
|
||||||
:states 'insert
|
|
||||||
:maps 'eshell-mode-map
|
|
||||||
"TAB" 'bash-completion-from-eshell))
|
|
||||||
(use-package corfu
|
(use-package corfu
|
||||||
|
:if (display-graphic-p)
|
||||||
:custom
|
:custom
|
||||||
(completion-cycle-threshold 3)
|
(corfu-cycle t) ;; Enable cycling for `corfu-next/previous'
|
||||||
|
(corfu-auto t) ;; Enable auto completion
|
||||||
|
(corfu-auto-delay 1.5)
|
||||||
|
(corfu-auto-prefix 2)
|
||||||
|
(corfu-separator ?-) ;; Orderless field separator
|
||||||
|
(corfu-quit-at-boundary 'separator) ;; Never quit at completion boundary
|
||||||
|
(corfu-quit-no-match 'separator) ;; Never quit, even if there is no match
|
||||||
|
(corfu-preview-current nil) ;; Disable current candidate preview
|
||||||
|
(corfu-preselect-first nil) ;; Disable candidate preselection
|
||||||
|
(corfu-on-exact-match nil) ;; Configure handling of exact matches
|
||||||
|
(corfu-scroll-margin 5) ;; Use scroll margin
|
||||||
|
(completion-cycle-threshold 0)
|
||||||
(tab-always-indent 'complete)
|
(tab-always-indent 'complete)
|
||||||
(corfu-auto t)
|
|
||||||
(corfu-quit-no-match t)
|
|
||||||
(corfu-count (- (window-total-height) 10))
|
|
||||||
;; (corfu-separator ";")
|
|
||||||
:init (global-corfu-mode)
|
:init (global-corfu-mode)
|
||||||
;; (defun corfu-enable-always-in-minibuffer ()
|
:config
|
||||||
;; "Enable Corfu in the minibuffer if Vertico/Mct are not active."
|
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-silent)
|
||||||
;; (unless (or (bound-and-true-p mct--active)
|
(advice-add 'pcomplete-completions-at-point :around #'cape-wrap-purify)
|
||||||
;; (bound-and-true-p vertico--input))
|
|
||||||
;; (setq-local corfu-auto nil) ;; Enable/disable auto completion
|
|
||||||
;; (corfu-mode 1)
|
|
||||||
;; (minibuffer-complete)))
|
|
||||||
;; (add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)
|
|
||||||
;; (defun corfu-kill-in-minibuffer ()
|
|
||||||
;; "Kill corfu and minibuffer. To be bound to Esc."
|
|
||||||
;; (interactive)
|
|
||||||
;; (setq-local inhibit-debugger t)
|
|
||||||
;; (corfu-quit)
|
|
||||||
;; (exit-minibuffer)
|
|
||||||
;; )
|
|
||||||
(defun corfu-send-shell (&rest _)
|
|
||||||
"Send completion candidate when inside comint/eshell."
|
|
||||||
(cond
|
|
||||||
((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
|
|
||||||
(eshell-send-input))
|
|
||||||
((and (derived-mode-p 'comint-mode) (fboundp 'comint-send-input))
|
|
||||||
(comint-send-input))))
|
|
||||||
:general
|
:general
|
||||||
(general-define-key
|
(general-define-key
|
||||||
:prefix-map 'corfu-map
|
:states 'insert
|
||||||
"C-n" 'corfu-next
|
:keymaps 'corfu-map
|
||||||
"C-p" 'corfu-previous
|
[tab] 'corfu-next
|
||||||
|
[backtab] 'corfu-previous
|
||||||
"RET" 'corfu-insert
|
"RET" 'corfu-insert
|
||||||
"ESC" 'corfu-quit))
|
|
||||||
|
|
||||||
(use-package popon
|
(use-package popon
|
||||||
:straight
|
:straight
|
||||||
(:type git
|
(:type git
|
||||||
:repo "https://codeberg.org/akib/emacs-popon")
|
:repo "https://codeberg.org/akib/emacs-popon")
|
||||||
|
"ESC" 'corfu-quit
|
||||||
|
"C-h" 'corfu-info-documentation
|
||||||
|
"C-f" 'corfu-info-location))
|
||||||
:if (not (display-graphic-p)))
|
:if (not (display-graphic-p)))
|
||||||
(use-package corfu-terminal
|
(use-package corfu-terminal
|
||||||
:straight
|
:straight
|
||||||
|
Loading…
Reference in New Issue
Block a user