dotfiles

Alpine Linux dotfiles

git clone git://git.lin.moe/dotfiles.git

 1;;; package --- 补全配置
 2;;; Commentary:
 3;;; Code:
 4
 5(use-package emacs
 6  :init
 7  (setq completion-cycle-threshold 3)
 8  (setq tab-always-indent 'complete))
 9
10(use-package eglot
11  ;; :hook ((go-mode . eglot-ensure)
12  ;;        (python-mode . eglot-ensure)
13  ;;        (zig-mode . eglot-ensure))
14  :config
15  (add-to-list 'display-buffer-alist '("*eldoc*"
16         (display-buffer-in-side-window)
17         (side . bottom)
18         (window-height . 0.16)
19         (slot . 0)))
20
21  (setq eglot-autoshutdown t
22        eglot-ignored-server-capabilities '(:inlayHintProvider)))
23
24(use-package vertico
25  :init
26  (vertico-mode +1))
27
28(use-package orderless
29  :init
30  (setq completion-styles '(orderless)
31        completion-category-defaults nil
32        completion-category-overrides '((file (styles . (partial-completion))))))
33
34(use-package consult
35  :init
36  :bind
37  ("C-s" . consult-line)
38  ("M-g g" . consult-goto-line)
39  ("C-c h" . consult-history)
40  ("C-x b" . consult-buffer)
41  ("C-x C-b" . consult-buffer)
42  ("C-x p b" . consult-project-buffer)
43  ("C-x r j" . consult-register)
44  ("M-'" . consult-register-load)
45  ("M-\"" . consult-register-store)          ;; orig. abbrev-prefix-mark (unrelated)
46  ("M-y" . consult-yank-pop)
47  ("C-c j" . consult-git-grep)
48  ("C-c f" . magit-find-file)
49  ("M-g i" . consult-imenu-multi)
50  ("M-g M-i" . imenu)
51  (:map org-mode-map
52        ("C-c s" . consult-org-heading)))
53
54(use-package embark
55  :bind
56  (("C-." . embark-act)         ;; pick some comfortable binding
57   ("C-;" . embark-dwim)        ;; good alternative: M-.
58   ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
59
60  :init
61  (setq prefix-help-command #'embark-prefix-help-command)
62  :config
63  (add-to-list 'display-buffer-alist
64               '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
65                 nil
66                 (window-parameters (mode-line-format . none)))))
67
68
69(use-package embark-consult
70  :hook
71  (embark-collect-mode . consult-preview-at-point-mode))
72
73(use-package marginalia
74  :bind (:map minibuffer-local-map
75         ("M-A" . marginalia-cycle))
76  :init
77  (marginalia-mode))
78
79(setq completion-in-region-function
80      (lambda (&rest args)
81        (apply (if vertico-mode
82                   #'consult-completion-in-region
83                 #'completion--in-region)
84               args)))
85    
86(provide 'init-completion)
87;;; init-completion.el ends here