switched to beta corfu doom package
This commit is contained in:
parent
d54ea39db3
commit
1a4fcfcd0b
6 changed files with 120 additions and 201 deletions
26
config.el
26
config.el
|
@ -12,34 +12,8 @@
|
||||||
;; accept. For example:
|
;; accept. For example:
|
||||||
(setq doom-font (font-spec :family "JetBrains Mono" :size 14))
|
(setq doom-font (font-spec :family "JetBrains Mono" :size 14))
|
||||||
(setq fancy-splash-image (concat doom-user-dir "splash.png"))
|
(setq fancy-splash-image (concat doom-user-dir "splash.png"))
|
||||||
|
|
||||||
;; There are two ways to load a theme. Both assume the theme is installed and
|
|
||||||
;; available. You can either set `doom-theme' or manually load a theme with the
|
|
||||||
;; `load-theme' function. This is the default:
|
|
||||||
(setq doom-theme 'doom-monokai-pro)
|
(setq doom-theme 'doom-monokai-pro)
|
||||||
|
|
||||||
;; config for icons. remove when main packages are fixed?
|
|
||||||
|
|
||||||
(setq
|
|
||||||
nerd-icons-font-family "Symbols Nerd Font Mono"
|
|
||||||
centaur-tabs-icon-type 'nerd-icons
|
|
||||||
)
|
|
||||||
|
|
||||||
(use-package! nerd-icons-completion
|
|
||||||
:after marginalia
|
|
||||||
:config
|
|
||||||
(nerd-icons-completion-mode)
|
|
||||||
(add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup))
|
|
||||||
|
|
||||||
(use-package! nerd-icons-dired
|
|
||||||
:hook
|
|
||||||
(dired-mode . nerd-icons-dired-mode))
|
|
||||||
|
|
||||||
(use-package! treemacs-nerd-icons
|
|
||||||
:after treemacs
|
|
||||||
:config
|
|
||||||
(treemacs-load-theme "nerd-icons"))
|
|
||||||
|
|
||||||
;; This determines the style of line numbers in effect. If set to `nil', line
|
;; This determines the style of line numbers in effect. If set to `nil', line
|
||||||
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
;; numbers are disabled. For relative line numbers, set this to `relative'.
|
||||||
(setq display-line-numbers-type t)
|
(setq display-line-numbers-type t)
|
||||||
|
|
4
init.el
4
init.el
|
@ -26,7 +26,7 @@
|
||||||
;;ido ; the other *other* search engine...
|
;;ido ; the other *other* search engine...
|
||||||
;;ivy ; a search engine for love and life
|
;;ivy ; a search engine for love and life
|
||||||
(vertico +orderless) ; the search engine of the future
|
(vertico +orderless) ; the search engine of the future
|
||||||
(corfu)
|
(corfu +orderless)
|
||||||
|
|
||||||
:ui
|
:ui
|
||||||
;;deft ; notational velocity for Emacs
|
;;deft ; notational velocity for Emacs
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
ophints ; highlight the region an operation acts on
|
ophints ; highlight the region an operation acts on
|
||||||
(popup +all +defaults) ; tame sudden yet inevitable temporary windows
|
(popup +all +defaults) ; tame sudden yet inevitable temporary windows
|
||||||
tabs ; a tab bar for Emacs
|
tabs ; a tab bar for Emacs
|
||||||
(treemacs +lsp +treemacs-git-mode) ; a project drawer, like neotree but cooler
|
(treemacs +lsp +icons) ; a project drawer, like neotree but cooler
|
||||||
;;unicode ; extended unicode support for various languages
|
;;unicode ; extended unicode support for various languages
|
||||||
(vc-gutter +pretty) ; vcs diff in the fringe
|
(vc-gutter +pretty) ; vcs diff in the fringe
|
||||||
vi-tilde-fringe ; fringe tildes to mark beyond EOB
|
vi-tilde-fringe ; fringe tildes to mark beyond EOB
|
||||||
|
|
|
@ -4,9 +4,9 @@
|
||||||
#+since: 3.0.0 (#7002)
|
#+since: 3.0.0 (#7002)
|
||||||
|
|
||||||
* Description :unfold:
|
* Description :unfold:
|
||||||
This module provides code completion, powered by [[https://github.com/minad/corfu][corfu]].
|
This module provides code completion, powered by [[doom-package:corfu]].
|
||||||
|
|
||||||
It is recommended to enable either this or [[doom-module:][:completion company]], in case you
|
It is recommended to enable either this or [[doom-module::completion company]], in case you
|
||||||
desire pre-configured auto-completion. Corfu is much lighter weight and focused,
|
desire pre-configured auto-completion. Corfu is much lighter weight and focused,
|
||||||
plus it's built on native Emacs functionality, whereas company is heavy and
|
plus it's built on native Emacs functionality, whereas company is heavy and
|
||||||
highly non-native, but has some extra features and more maturity.
|
highly non-native, but has some extra features and more maturity.
|
||||||
|
@ -23,12 +23,17 @@ highly non-native, but has some extra features and more maturity.
|
||||||
Invoke completion on [[kbd:][TAB]]. When corfu is active, [[kbd:][TAB]] and [[kbd:][S-TAB]] will navigate
|
Invoke completion on [[kbd:][TAB]]. When corfu is active, [[kbd:][TAB]] and [[kbd:][S-TAB]] will navigate
|
||||||
the completion candidates. Arrow keys and evil-style movement are still
|
the completion candidates. Arrow keys and evil-style movement are still
|
||||||
supported.
|
supported.
|
||||||
|
- +orderless ::
|
||||||
|
Pull in [[doom-package:orderless]] if necessary and apply multi-component
|
||||||
|
completion (still needed if [[:completion vertico]] is active).
|
||||||
|
|
||||||
** Packages
|
** Packages
|
||||||
- [[doom-package:][corfu]]
|
- [[doom-package:corfu]]
|
||||||
- [[doom-package:][cape]]
|
- [[doom-package:cape]]
|
||||||
- [[doom-package:][kind-icon]] if [[doom-module:][:completion corfu +icons]]
|
- [[doom-package:kind-icon]] if [[doom-module::completion corfu +icons]]
|
||||||
- [[doom-package:][corfu-terminal]] if [[doom-module:][:os tty]]
|
- [[doom-package:orderless]] if [[doom-module::completion corfu +orderless]]
|
||||||
|
- [[doom-package:corfu-terminal]] if [[doom-module::os tty]]
|
||||||
|
- [[doom-package:yasnippet-capf]] if [[doom-module::editor snippets]]
|
||||||
|
|
||||||
** Hacks
|
** Hacks
|
||||||
/No hacks documented for this module./
|
/No hacks documented for this module./
|
||||||
|
@ -46,7 +51,7 @@ languages may lack code completion support altogether). Run ~$ doom doctor~ to
|
||||||
find out if you're missing any dependencies. Note that corfu may have support
|
find out if you're missing any dependencies. Note that corfu may have support
|
||||||
for completions in languages that have no development intelligence, since it
|
for completions in languages that have no development intelligence, since it
|
||||||
supports generic, context insensitive candidates such as file names or recurring
|
supports generic, context insensitive candidates such as file names or recurring
|
||||||
words.
|
words. Snippets may also appear in the candidate list if available.
|
||||||
|
|
||||||
* TODO Usage
|
* TODO Usage
|
||||||
#+begin_quote
|
#+begin_quote
|
||||||
|
@ -90,7 +95,7 @@ additional binds:
|
||||||
| [[kbd:][S-TAB]] | (when completing) Go to previous candidate |
|
| [[kbd:][S-TAB]] | (when completing) Go to previous candidate |
|
||||||
|
|
||||||
** Searching with multiple keywords
|
** Searching with multiple keywords
|
||||||
If the [[doom-module:][:completion vertico]] module is enabled, users can perform code completion
|
If the ~+orderless~ flag is enabled, users can perform code completion
|
||||||
with multiple search keywords by use of space as separator. More information can
|
with multiple search keywords by use of space as separator. More information can
|
||||||
be found [[https://github.com/oantolin/orderless#company][here]]. Pressing [[kdb:][C-SPC]] again while completing inserts a space as
|
be found [[https://github.com/oantolin/orderless#company][here]]. Pressing [[kdb:][C-SPC]] again while completing inserts a space as
|
||||||
separator. This allows searching with space-separated terms; each piece will
|
separator. This allows searching with space-separated terms; each piece will
|
||||||
|
@ -98,48 +103,27 @@ match individually and in any order, with smart casing. Pressing just [[kbd:][SP
|
||||||
as normal and restarts completion, so that when typing sentences it doesn't try
|
as normal and restarts completion, so that when typing sentences it doesn't try
|
||||||
to complete the whole sentence instead of just the word.
|
to complete the whole sentence instead of just the word.
|
||||||
|
|
||||||
Without [[doom-module:][:completion vertico]], it still works, just not as intelligently, due to
|
|
||||||
the lack of orderless.
|
|
||||||
|
|
||||||
** Exporting to the minibuffer (requires [[doom-module:][:completion vertico]])
|
** Exporting to the minibuffer (requires [[doom-module:][:completion vertico]])
|
||||||
When using the [[doom-module:][:completion vertico]] module, which pulls in the [[doom-package:][consult]] package,
|
When using the [[doom-module::completion vertico]] module, which pulls in the
|
||||||
the entries shown in the completion popup can be exported to a consult
|
[[doom-package:consult]] package, the entries shown in the completion popup can be
|
||||||
minibuffer, giving access to all the manipulations the vertico suite allows. For
|
exported to a consult minibuffer, giving access to all the manipulations the
|
||||||
instance, one could use this to export with [[doom-package:][embark]] via [[kbd:][C-c C-l]] and get a buffer
|
vertico suite allows. For instance, one could use this to export with
|
||||||
with all candidates.
|
[[doom-package:embark]] via [[kbd:][C-c C-l]] and get a buffer with all candidates.
|
||||||
|
|
||||||
** Ispell completion
|
|
||||||
Ispell completion is supported, so long as you point to the right ~.dic~ file in
|
|
||||||
~ispell-alternate-dictionary~. For selected text modes (see the configuration
|
|
||||||
section) it completes everywhere, for programming modes it can complete in
|
|
||||||
comments and strings.
|
|
||||||
|
|
||||||
* Configuration
|
* Configuration
|
||||||
A few variables may be set to change behavior of this module:
|
A few variables may be set to change behavior of this module:
|
||||||
|
|
||||||
- +corfu-auto-delay ::
|
- [[var:corfu-auto-delay]] ::
|
||||||
Number of seconds till completion occurs automatically. Defaults to 0.1.
|
Number of seconds till completion occurs automatically. Defaults to 0.1.
|
||||||
- +corfu-auto-prefix ::
|
- [[var:corfu-auto-prefix]] ::
|
||||||
Number of characters till auto-completion starts to happen. Defaults to 2.
|
Number of characters till auto-completion starts to happen. Defaults to 2.
|
||||||
- +corfu-want-multi-component ::
|
- [[var:+corfu-want-multi-component]] ::
|
||||||
Sets whether orderless-style matching should be supported with space as a
|
Sets whether orderless-style matching should be supported with space as a
|
||||||
separator.
|
separator.
|
||||||
- +corfu-ispell-completion-modes ::
|
- [[var:corfu-on-exact-match]] ::
|
||||||
Lists modes in which to add ~cape-ispell~ as a capf. These show be majorly
|
Configures behavior for exact matches. Its default is nil, and it's
|
||||||
text modes, else you will get lots of bad suggestions, since when this matches
|
recommended to leave it at that. Otherwise, single matches on snippet keys
|
||||||
it interrupts the flow of candidate selection.
|
expand immediately.
|
||||||
- +corfu-ispell-in-comments-and-strings ::
|
|
||||||
Whether we should complete when point is inside a string or comment. If
|
|
||||||
non-nil, works as in a text mode, else gives programming completions just like
|
|
||||||
in the rest of the buffer.
|
|
||||||
|
|
||||||
Additionally, if you prefer to never stop completion on [[kbd:][SPC]], add the following
|
|
||||||
to your ~config.el~:
|
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(map! :map corfu-map
|
|
||||||
:desc "insert separator" "C-SPC" #'corfu-insert-separator)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
* Troubleshooting
|
* Troubleshooting
|
||||||
[[doom-report:][Report an issue?]]
|
[[doom-report:][Report an issue?]]
|
||||||
|
|
|
@ -1,168 +1,127 @@
|
||||||
;;; completion/corfu/config.el -*- lexical-binding: t; -*-
|
;;; completion/corfu/config.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
(defvar +corfu-auto-delay 0.1
|
|
||||||
"How long after point stands still will completion be called automatically,
|
|
||||||
in seconds.
|
|
||||||
|
|
||||||
Setting `corfu-auto-delay' directly may not work, as it needs to be set *before*
|
|
||||||
enabling `corfu-mode'.")
|
|
||||||
(defvar +corfu-auto-prefix 2
|
|
||||||
"How many characters should be typed before auto-complete starts to kick in.
|
|
||||||
|
|
||||||
Setting `corfu-auto-prefix' directly may not work, as it needs to be set
|
|
||||||
*before* enabling `corfu-mode'.")
|
|
||||||
(defvar +corfu-want-multi-component t
|
|
||||||
"Enables multiple component search, with pieces separated by spaces.
|
|
||||||
|
|
||||||
This allows search of non-contiguous unordered bits, for instance by typing
|
|
||||||
\"tear rip\" to match \"rip-and-tear\". Notice the space, it does not break
|
|
||||||
completion in this case.")
|
|
||||||
(defvar +corfu-icon-height 0.9
|
|
||||||
"The height applied to the icons (it is passed to both svg-lib and kind-icon).
|
|
||||||
|
|
||||||
It may need tweaking for the completions to not become cropped at the end.
|
|
||||||
Note that changes are applied only after a cache reset, via
|
|
||||||
`kind-icon-reset-cache'.")
|
|
||||||
|
|
||||||
(defvar +corfu-ispell-completion-modes '(org-mode markdown-mode text-mode)
|
|
||||||
"Modes to enable ispell completion in.
|
|
||||||
|
|
||||||
For completion in comments, see `+corfu-ispell-in-comments-and-strings'.")
|
|
||||||
(defvar +corfu-ispell-in-comments-and-strings t
|
|
||||||
"Enable completion with ispell inside comments when in a `prog-mode'
|
|
||||||
derivative.")
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Packages
|
;;; Packages
|
||||||
(use-package! corfu
|
(use-package! corfu
|
||||||
:hook (doom-first-buffer . global-corfu-mode)
|
:hook (doom-first-buffer . global-corfu-mode)
|
||||||
:init
|
:init
|
||||||
;; Auto-completion settings, must be set before calling `global-corfu-mode'.
|
;; Auto-completion settings, must be set before calling `global-corfu-mode'.
|
||||||
|
;; Due to lazy-loading, setting them in config.el works too.
|
||||||
(setq corfu-auto t
|
(setq corfu-auto t
|
||||||
corfu-auto-delay +corfu-auto-delay
|
corfu-auto-delay 0.1
|
||||||
corfu-auto-prefix +corfu-auto-prefix
|
corfu-auto-prefix 2
|
||||||
corfu-excluded-modes '(erc-mode
|
corfu-excluded-modes '(erc-mode
|
||||||
circe-mode
|
circe-mode
|
||||||
help-mode
|
help-mode
|
||||||
gud-mode
|
gud-mode
|
||||||
vterm-mode))
|
vterm-mode))
|
||||||
|
|
||||||
:config
|
:config
|
||||||
(when (and (modulep! :tools lsp) (not (modulep! :tools lsp +eglot)))
|
|
||||||
(add-hook 'lsp-mode-hook (defun doom--add-lsp-capf ()
|
|
||||||
(add-to-list 'completion-at-point-functions (cape-capf-buster #'lsp-completion-at-point)))
|
|
||||||
;; Below is so that context specific completions in cape come first.
|
|
||||||
:depth 1))
|
|
||||||
(add-to-list 'completion-styles 'partial-completion t)
|
(add-to-list 'completion-styles 'partial-completion t)
|
||||||
(add-to-list 'completion-styles 'initials t)
|
(add-to-list 'completion-styles 'initials t)
|
||||||
(setq corfu-cycle t
|
(setq corfu-cycle t
|
||||||
corfu-separator (when +corfu-want-multi-component ?\s)
|
corfu-separator (when (modulep! +orderless) ?\s)
|
||||||
corfu-preselect t
|
corfu-preselect t
|
||||||
corfu-count 16
|
corfu-count 16
|
||||||
corfu-max-width 120
|
corfu-max-width 120
|
||||||
corfu-preview-current 'insert
|
corfu-preview-current 'insert
|
||||||
corfu-quit-at-boundary (if +corfu-want-multi-component 'separator t)
|
corfu-on-exact-match nil
|
||||||
corfu-quit-no-match (if +corfu-want-multi-component 'separator t)
|
corfu-quit-at-boundary (if (modulep! +orderless) 'separator t)
|
||||||
|
corfu-quit-no-match (if (modulep! +orderless) 'separator t)
|
||||||
;; In the case of +tng, TAB should be smart regarding completion;
|
;; In the case of +tng, TAB should be smart regarding completion;
|
||||||
;; However, it should otherwise behave like normal, whatever normal was.
|
;; However, it should otherwise behave like normal, whatever normal was.
|
||||||
tab-always-indent (if (modulep! +tng) 'complete tab-always-indent))
|
tab-always-indent (if (modulep! +tng) 'complete tab-always-indent))
|
||||||
;; Only done with :tools vertico active due to orderless. Alternatively, we
|
(when (modulep! +orderless)
|
||||||
;; could set it up here if it's not there.
|
|
||||||
(when (and +corfu-want-multi-component (modulep! :completion vertico))
|
|
||||||
(cond ((modulep! :tools lsp +eglot) (add-to-list 'completion-category-overrides '(eglot (styles orderless))))
|
(cond ((modulep! :tools lsp +eglot) (add-to-list 'completion-category-overrides '(eglot (styles orderless))))
|
||||||
((modulep! :tools lsp) (add-hook 'lsp-completion-mode-hook
|
((modulep! :tools lsp) (add-hook 'lsp-completion-mode-hook
|
||||||
(defun doom--use-orderless-lsp-capf ()
|
(defun doom--use-orderless-lsp-capf ()
|
||||||
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
|
(setf (alist-get 'styles (alist-get 'lsp-capf completion-category-defaults))
|
||||||
'(orderless)))))))
|
'(orderless)))))))
|
||||||
(map! (:unless (modulep! +tng)
|
(map! (:unless (modulep! +tng)
|
||||||
:desc "complete" "C-SPC" #'completion-at-point)
|
"C-SPC" #'completion-at-point)
|
||||||
(:map 'corfu-map
|
(:map 'corfu-map
|
||||||
(:when +corfu-want-multi-component
|
(:when (modulep! +orderless)
|
||||||
:desc "insert separator" "C-SPC" #'corfu-insert-separator)
|
"C-SPC" #'corfu-insert-separator)
|
||||||
(:when (modulep! :completion vertico)
|
|
||||||
:desc "move to minibuffer" "s-<down>" #'corfu-move-to-minibuffer
|
|
||||||
(:when (modulep! :editor evil)
|
|
||||||
:desc "move to minibuffer" "s-j" #'corfu-move-to-minibuffer))
|
|
||||||
(:when (modulep! +tng)
|
(:when (modulep! +tng)
|
||||||
:desc "next" [tab] #'corfu-next
|
[tab] #'corfu-next
|
||||||
:desc "previous" [backtab] #'corfu-previous
|
[backtab] #'corfu-previous
|
||||||
:desc "next" "TAB" #'corfu-next
|
"TAB" #'corfu-next
|
||||||
:desc "previous" "S-TAB" #'corfu-previous))))
|
"S-TAB" #'corfu-previous)))
|
||||||
|
|
||||||
;; Taken from corfu's README.
|
(when (modulep! :editor evil)
|
||||||
;; TODO: extend this to other completion front-ends, mainly helm and ido, since
|
(evil-collection-define-key 'insert 'corfu-map
|
||||||
;; ivy is being considered for removal.
|
(kbd "RET") #'corfu-insert
|
||||||
(when (modulep! :completion vertico)
|
[return] #'corfu-insert))
|
||||||
(defun corfu-move-to-minibuffer ()
|
|
||||||
(interactive)
|
(after! vertico
|
||||||
(let ((completion-extra-properties corfu--extra)
|
;; Taken from corfu's README.
|
||||||
completion-cycle-threshold completion-cycling)
|
;; TODO: extend this to other completion front-ends.
|
||||||
(apply #'consult-completion-in-region completion-in-region--data))))
|
(defun corfu-move-to-minibuffer ()
|
||||||
|
(interactive)
|
||||||
|
(let ((completion-extra-properties corfu--extra)
|
||||||
|
(completion-cycle-threshold completion-cycling))
|
||||||
|
(apply #'consult-completion-in-region completion-in-region--data)))
|
||||||
|
(map! :map 'corfu-map "s-<down>" #'corfu-move-to-minibuffer
|
||||||
|
(:when (modulep! :editor evil) "s-j" #'corfu-move-to-minibuffer))))
|
||||||
|
|
||||||
(use-package! cape
|
(use-package! cape
|
||||||
:after corfu
|
:after corfu
|
||||||
:commands (cape-dabbrev
|
|
||||||
cape-file
|
|
||||||
cape-history
|
|
||||||
cape-keyword
|
|
||||||
cape-tex
|
|
||||||
cape-sgml
|
|
||||||
cape-rfc1345
|
|
||||||
cape-abbrev
|
|
||||||
cape-ispell
|
|
||||||
cape-dict
|
|
||||||
cape-symbol
|
|
||||||
cape-line)
|
|
||||||
:init
|
|
||||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
|
||||||
(when +corfu-ispell-in-comments-and-strings
|
|
||||||
(defalias 'corfu--ispell-in-comments-and-strings
|
|
||||||
(cape-super-capf (cape-capf-inside-comment #'cape-ispell)
|
|
||||||
(cape-capf-inside-string #'cape-ispell)))
|
|
||||||
(add-hook 'prog-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(add-to-list 'completion-at-point-functions #'corfu--ispell-in-comments-and-strings))))
|
|
||||||
(dolist (sym +corfu-ispell-completion-modes)
|
|
||||||
(add-hook (intern (concat (symbol-name sym) "-hook"))
|
|
||||||
(lambda ()
|
|
||||||
(add-to-list 'completion-at-point-functions #'cape-ispell))))
|
|
||||||
(add-hook! '(TeX-mode-hook LaTeX-mode-hook org-mode-hook)
|
|
||||||
(lambda ()
|
|
||||||
(add-to-list 'completion-at-point-functions #'cape-tex t))
|
|
||||||
:depth 2)
|
|
||||||
(add-hook! '(html-mode-hook +web-react-mode-hook typescript-tsx-mode-hook org-mode-hook markdown-mode-hook)
|
|
||||||
(lambda ()
|
|
||||||
(add-to-list 'completion-at-point-functions #'cape-sgml t))
|
|
||||||
:depth 2)
|
|
||||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
|
||||||
(add-to-list 'completion-at-point-functions #'cape-keyword)
|
|
||||||
:config
|
:config
|
||||||
;; Enhances speed on large projects, for which many buffers may be open.
|
(add-hook 'prog-mode-hook
|
||||||
(setq cape-dabbrev-check-other-buffers nil))
|
(lambda () (add-to-list 'completion-at-point-functions #'cape-file)))
|
||||||
|
(add-hook! (markdown-mode org-mode)
|
||||||
|
(lambda () (add-to-list 'completion-at-point-functions #'cape-elisp-block))))
|
||||||
|
|
||||||
|
(use-package! yasnippet-capf
|
||||||
|
:after corfu
|
||||||
|
:config
|
||||||
|
(add-hook 'yas-minor-mode-hook
|
||||||
|
(lambda () (add-to-list 'completion-at-point-functions #'yasnippet-capf))))
|
||||||
|
|
||||||
|
(use-package! svg-lib
|
||||||
|
:after kind-icon)
|
||||||
(use-package! kind-icon
|
(use-package! kind-icon
|
||||||
:when (modulep! +icons)
|
:commands (kind-icon-margin-formatter
|
||||||
:commands kind-icon-margin-formatter
|
kind-icon-reset-cache
|
||||||
|
kind-icon-formatted)
|
||||||
:init
|
:init
|
||||||
(add-hook 'corfu-margin-formatters #'kind-icon-margin-formatter)
|
(add-hook 'corfu-margin-formatters #'kind-icon-margin-formatter)
|
||||||
:config
|
:config
|
||||||
(setq kind-icon-default-face 'corfu-default
|
(defface corfu-kind-icon '((t :inherit corfu-default))
|
||||||
|
"Face for the icons in the corfu popup.
|
||||||
|
For changing color, you should probably use `kind-icon-mapping', which see. The
|
||||||
|
purpose here is overriding size and helping with scaling issues."
|
||||||
|
:group 'corfu)
|
||||||
|
(setq kind-icon-default-face 'corfu-kind-icon
|
||||||
kind-icon-blend-background t
|
kind-icon-blend-background t
|
||||||
kind-icon-blend-frac 0.2)
|
kind-icon-blend-frac 0.2)
|
||||||
(plist-put kind-icon-default-style :height +corfu-icon-height)
|
(let ((def-style (svg-lib-style-compute-default 'corfu-kind-icon))
|
||||||
(plist-put svg-lib-style-default :height +corfu-icon-height))
|
res)
|
||||||
|
(cl-loop for (key value) on def-style by 'cddr
|
||||||
|
do (unless (member key '(:foreground
|
||||||
|
:background
|
||||||
|
:font-size
|
||||||
|
:font-width
|
||||||
|
:font-weight
|
||||||
|
:font-family
|
||||||
|
:width))
|
||||||
|
(setq res (plist-put res key value))))
|
||||||
|
(setq kind-icon-default-style (plist-put res :stroke 0.25)))
|
||||||
|
(defadvice! doom--kind-icon-remove-padding (orig kind)
|
||||||
|
"Rescale icon images to 1, and set surrounding spaces to width 0.
|
||||||
|
This fixes the cropping due to scaling issues."
|
||||||
|
:around #'kind-icon-formatted
|
||||||
|
(let* ((text (funcall orig kind))
|
||||||
|
(image (get-text-property 1 'display text)))
|
||||||
|
(when (eq (car-safe image) 'image)
|
||||||
|
(setf (image-property image :scale) 1)
|
||||||
|
(put-text-property 0 1 'display '(space :width (0)) text)
|
||||||
|
(put-text-property 2 3 'display '(space :width (0)) text))
|
||||||
|
text)))
|
||||||
|
|
||||||
(use-package! corfu-terminal
|
(use-package! corfu-terminal
|
||||||
:when (and (modulep! :os tty) (not (display-graphic-p)))
|
:when (not (display-graphic-p))
|
||||||
:hook (corfu-mode . corfu-terminal-mode))
|
:hook (corfu-mode . corfu-terminal-mode))
|
||||||
|
|
||||||
(use-package! dabbrev
|
|
||||||
:config
|
|
||||||
(setq dabbrev-ignored-buffer-regexps '("\\.\\(?:pdf\\|jpe?g\\|png\\)\\'")))
|
|
||||||
|
|
||||||
(setq read-extended-command-predicate
|
|
||||||
#'command-completion-default-include-p)
|
|
||||||
|
|
||||||
;;
|
;;
|
||||||
;;; Extensions
|
;;; Extensions
|
||||||
(use-package! corfu-history
|
(use-package! corfu-history
|
||||||
|
@ -175,14 +134,14 @@ derivative.")
|
||||||
:config
|
:config
|
||||||
(setq corfu-popupinfo-delay '(0.5 . 1.0))
|
(setq corfu-popupinfo-delay '(0.5 . 1.0))
|
||||||
(map! (:map 'corfu-map
|
(map! (:map 'corfu-map
|
||||||
:desc "scroll info up" "C-<up>" #'corfu-popupinfo-scroll-down
|
"C-<up>" #'corfu-popupinfo-scroll-down
|
||||||
:desc "scroll info down" "C-<down>" #'corfu-popupinfo-scroll-up
|
"C-<down>" #'corfu-popupinfo-scroll-up
|
||||||
:desc "scroll info up" "C-S-p" #'corfu-popupinfo-scroll-down
|
"C-S-p" #'corfu-popupinfo-scroll-down
|
||||||
:desc "scroll info down" "C-S-n" #'corfu-popupinfo-scroll-up
|
"C-S-n" #'corfu-popupinfo-scroll-up
|
||||||
:desc "toggle info" "C-h" #'corfu-popupinfo-toggle)
|
"C-h" #'corfu-popupinfo-toggle)
|
||||||
(:map 'corfu-popupinfo-map
|
(:map 'corfu-popupinfo-map
|
||||||
:when (modulep! :editor evil)
|
:when (modulep! :editor evil)
|
||||||
;; Reversed because popupinfo assumes opposite of what feels intuitive
|
;; Reversed because popupinfo assumes opposite of what feels intuitive
|
||||||
;; with evil.
|
;; with evil.
|
||||||
:desc "scroll info up" "C-S-k" #'corfu-popupinfo-scroll-down
|
"C-S-k" #'corfu-popupinfo-scroll-down
|
||||||
:desc "scroll info down" "C-S-j" #'corfu-popupinfo-scroll-up)))
|
"C-S-j" #'corfu-popupinfo-scroll-up)))
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
;; -*- no-byte-compile: t; -*-
|
;; -*- no-byte-compile: t; -*-
|
||||||
;;; completion/corfu/packages.el
|
;;; completion/corfu/packages.el
|
||||||
|
|
||||||
(package! corfu :recipe (:files ("*.el" "extensions/*.el")))
|
(package! corfu :recipe (:files ("*.el" "extensions/*.el")) :pin "a4f003605bc712952e5f2fc27d87730c312fdbeb")
|
||||||
(package! cape)
|
(package! cape :pin "5b28cd43f2efa19dbf5053f164cce622a4b5bdae")
|
||||||
(package! dabbrev)
|
|
||||||
(when (modulep! +icons)
|
(when (modulep! +icons)
|
||||||
(package! kind-icon))
|
(package! svg-lib :pin "b2a168482f85a308a4ab95c03e3c2bd71981e166")
|
||||||
|
(package! kind-icon :pin "b0fb83be6ff6837446274e44e799ade836854a39"))
|
||||||
|
(when (modulep! +orderless)
|
||||||
|
(package! orderless :pin "e6784026717a8a6a7dcd0bf31fd3414f148c542e"))
|
||||||
(when (modulep! :os tty)
|
(when (modulep! :os tty)
|
||||||
(package! corfu-terminal)
|
(package! corfu-terminal :pin "5ce4c11b8efd4d2fd1b404b9422bb85b05476da0"))
|
||||||
(package! corfu-doc-terminal))
|
(when (modulep! :editor snippets)
|
||||||
|
(package! yasnippet-capf :pin "40654214db7a44db3a99321447632b43a10fae57"))
|
||||||
;; (package! cape-yasnippet)
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
(package! nerd-icons-completion)
|
(package! nerd-icons-completion)
|
||||||
(package! nerd-icons-dired)
|
(package! nerd-icons-dired)
|
||||||
(package! treemacs-nerd-icons)
|
(package! treemacs-nerd-icons)
|
||||||
|
(package! kind-icon)
|
||||||
|
|
||||||
(package! obsidian)
|
(package! obsidian)
|
||||||
(package! w3m)
|
(package! w3m)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue