-
Notifications
You must be signed in to change notification settings - Fork 1
/
про-автодополнение.el
89 lines (76 loc) · 2.8 KB
/
про-автодополнение.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
;;; про-автодополнение.el --- Автодополнение строк -*- lexical-binding: t -*-
;;; Commentary:
;; Автодополнение текста (на базе Corfu)
;;; Code:
;;;; Инициализация Corfu
;; https://github.com/minad/corfu
(use-package corfu
:ensure t
:defines (corfu-map)
:functions (corfu-mode global-corfu-mode corfu-popupinfo-mode corfu-history-mode)
:bind (:map corfu-map
("<escape>". corfu-quit)
("<return>" . corfu-insert)
("C-h" . corfu-info-documentation)
("M-l" . corfu-info-location)
("C-n" . corfu-quit)
("C-p" . corfu-quit)
("C-n" . corfu-next)
("C-p" . corfu-previous)
("TAB" . corfu-next)
([tab] . corfu-next)
("S-TAB" . corfu-previous)
([backtab] . corfu-previous))
:custom
(tab-always-indent 'complete)
(completion-cycle-threshold nil)
(corfu-auto nil)
(corfu-auto-prefix 2)
(corfu-auto-delay 0)
(corfu-popupinfo-delay 0)
(corfu-min-width 5)
(corfu-max-width 70)
(corfu-count 14)
(corfu-scroll-margin 3)
(corfu-cycle t)
(corfu-echo-documentation nil)
(corfu-separator ?\s)
(corfu-quit-no-match 'separator)
(corfu-preview-current t)
(corfu-preselect 'promt)
:config
(require 'corfu)
;; Включен глобальный режим автодополнения
(global-corfu-mode t)
(corfu-popupinfo-mode)
(corfu-history-mode)
(defun в-минибуфере-включать-corfu ()
"Включать Corfu в минибуфере если Vertico/Mct не активны."
(unless (or (bound-and-true-p mct--active)
(bound-and-true-p vertico--input))
(setq-local corfu-auto nil)
(corfu-mode 1)))
(add-hook 'minibuffer-setup-hook #'в-минибуфере-включать-corfu 1))
;;;; Предпросмотр первого кандидата
;; (use-package corfu-candidate-overlay
;; :ensure t
;; :after corfu
;; :defines (corfu-candidate-overlay-map corfu-mode-map)
;; :functions (corfu-candidate-overlay-mode)
;; :bind (:map corfu-mode-map
;; ("M-TAB" . corfu-candidate-overlay-complete-at-point))
;; :hook ((emacs-lisp-mode . corfu-candidate-overlay-mode)
;; ((typescript-ts-mode . corfu-candidate-overlay-mode)
;; (js-ts-mode . corfu-candidate-overlay-mode)))
;; :config
;; ;;(global-set-key (kbd "M-<tab>") 'completion-at-point)
;; )
;;;; Расширения для автодополнения
(use-package cape
:ensure t
:init)
;;;; Автодополнение для терминала
(use-package corfu-terminal
:ensure t)
(provide 'про-автодополнение)
;;; про-автодополнение.el ends here