making repo for config
This commit is contained in:
commit
6261a44aa4
13 changed files with 1243 additions and 0 deletions
39
modules/completion/corfu/autoload/extra.el
Normal file
39
modules/completion/corfu/autoload/extra.el
Normal file
|
@ -0,0 +1,39 @@
|
|||
;;; completion/corfu/autoload.el -*- lexical-binding: t; -*-
|
||||
|
||||
;;;###autoload
|
||||
(defun +corfu-complete-file-at-point ()
|
||||
"Complete a file path from scratch at point"
|
||||
(interactive)
|
||||
(completion-in-region (point) (point) #'read-file-name-internal))
|
||||
|
||||
;;;###autoload
|
||||
(defun +corfu-files ()
|
||||
"Complete using files source"
|
||||
(interactive)
|
||||
(let ((completion-at-point-functions (list #'+file-completion-at-point-function)))
|
||||
(completion-at-point)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +corfu-dabbrev ()
|
||||
"Complete using dabbrev source"
|
||||
(interactive)
|
||||
(let ((completion-at-point-functions (list #'+dabbrev-completion-at-point-function)))
|
||||
(completion-at-point)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +corfu-ispell ()
|
||||
"Complete using ispell source.
|
||||
|
||||
See `ispell-lookup-words' for more info"
|
||||
(interactive)
|
||||
(let ((completion-at-point-functions (list #'+ispell-completion-at-point-function)))
|
||||
(completion-at-point)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +corfu-dict ()
|
||||
"Complete using dict source.
|
||||
|
||||
See `+dict--words' for extra words, and `+dict-file' for a wordslist source "
|
||||
(interactive)
|
||||
(let ((completion-at-point-functions (list #'+dict-completion-at-point-function)))
|
||||
(completion-at-point)))
|
75
modules/completion/corfu/autoload/minad-capf.el
Normal file
75
modules/completion/corfu/autoload/minad-capf.el
Normal file
|
@ -0,0 +1,75 @@
|
|||
;; Daniel "minad" Mendler extra capfs -*- lexical-binding: t -*-
|
||||
;; Source : https://github.com/minad/corfu/issues/9#issuecomment-945090516
|
||||
|
||||
(require 'dabbrev)
|
||||
|
||||
;;;###autoload
|
||||
(defun +file-completion-at-point-function ()
|
||||
"File name completion-at-point-function."
|
||||
(when-let (bounds (bounds-of-thing-at-point 'filename))
|
||||
(list (car bounds) (cdr bounds)
|
||||
'read-file-name-internal
|
||||
:exclusive 'no
|
||||
:annotation-function (lambda (_) " (File)"))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +dabbrev-completion-at-point-function ()
|
||||
(let ((dabbrev-check-all-buffers nil)
|
||||
(dabbrev-check-other-buffers nil))
|
||||
(dabbrev--reset-global-variables))
|
||||
(let ((abbrev (ignore-errors (dabbrev--abbrev-at-point))))
|
||||
(when (and abbrev (not (string-match-p "[ \t]" abbrev)))
|
||||
(pcase ;; Interruptible scanning
|
||||
(while-no-input
|
||||
(let ((inhibit-message t)
|
||||
(message-log-max nil))
|
||||
(or (dabbrev--find-all-expansions
|
||||
abbrev (dabbrev--ignore-case-p abbrev))
|
||||
t)))
|
||||
('nil (keyboard-quit))
|
||||
('t nil)
|
||||
(words
|
||||
;; Ignore completions which are too short
|
||||
(let ((min-len (+ 4 (length abbrev))))
|
||||
(setq words (seq-remove (lambda (x) (< (length x) min-len)) words)))
|
||||
(when words
|
||||
(let ((beg (progn (search-backward abbrev) (point)))
|
||||
(end (progn (search-forward abbrev) (point))))
|
||||
(unless (string-match-p "\n" (buffer-substring beg end))
|
||||
(list beg end words
|
||||
:exclusive 'no
|
||||
:annotation-function (lambda (_) " (Dabbrev)"))))))))))
|
||||
|
||||
(autoload 'ispell-lookup-words "ispell")
|
||||
|
||||
;;;###autoload
|
||||
(defun +ispell-completion-at-point-function ()
|
||||
(when-let* ((bounds (bounds-of-thing-at-point 'word))
|
||||
(table (with-demoted-errors
|
||||
(let ((message-log-max nil)
|
||||
(inhibit-message t))
|
||||
(ispell-lookup-words
|
||||
(format "*%s*"
|
||||
(buffer-substring-no-properties (car bounds) (cdr bounds))))))))
|
||||
(list (car bounds) (cdr bounds) table
|
||||
:exclusive 'no
|
||||
:annotation-function (lambda (_) " (Ispell)"))))
|
||||
|
||||
(defun +word-completion-at-point-function (words)
|
||||
(when-let (bounds (bounds-of-thing-at-point 'word))
|
||||
(list (car bounds) (cdr bounds) words
|
||||
:exclusive 'no
|
||||
:annotation-function (lambda (_) " (Words)"))))
|
||||
|
||||
(defvar +dict--words nil)
|
||||
(defvar +dict-file "/etc/dictionaries-common/words")
|
||||
|
||||
;;;###autoload
|
||||
(defun +dict-completion-at-point-function ()
|
||||
(+word-completion-at-point-function
|
||||
(or +dict--words
|
||||
(setq +dict--words
|
||||
(split-string (with-temp-buffer
|
||||
(insert-file-contents-literally +dict-file)
|
||||
(buffer-string))
|
||||
"\n")))))
|
13
modules/completion/corfu/autoload/minibuffer.el
Normal file
13
modules/completion/corfu/autoload/minibuffer.el
Normal file
|
@ -0,0 +1,13 @@
|
|||
;;; completion/corfu/autoload/corfu.el -*- lexical-binding: t; -*-
|
||||
;;;###if (modulep! :completion corfu +minibuffer)
|
||||
|
||||
;;;###autoload
|
||||
(defun +corfu--enable-in-minibuffer ()
|
||||
(unless (or (bound-and-true-p mct--active)
|
||||
(bound-and-true-p vertico--input)
|
||||
(memq this-command '(evil-ex
|
||||
evil-ex-search-forward
|
||||
evil-ex-search-backward))
|
||||
(and (modulep! :completion helm)
|
||||
(helm--alive-p))
|
||||
(corfu-mode +1))))
|
215
modules/completion/corfu/config.el
Normal file
215
modules/completion/corfu/config.el
Normal file
|
@ -0,0 +1,215 @@
|
|||
;;; completion/corfu/config.el -*- lexical-binding: t; -*-
|
||||
|
||||
;; Corfu completion module
|
||||
|
||||
(defvar +corfu-global-capes
|
||||
'(cape-yasnippet
|
||||
:completion
|
||||
cape-dict)
|
||||
"A list of global capes to be available at all times.
|
||||
The key :completion is used to specify where completion candidates should be
|
||||
placed, otherwise they come first.")
|
||||
|
||||
(defvar +corfu-capf-hosts
|
||||
'(lsp-completion-at-point
|
||||
eglot-completion-at-point
|
||||
elisp-completion-at-point
|
||||
tags-completion-at-point-function)
|
||||
"A prioritised list of host capfs to create a super cape onto from
|
||||
`+corfu-global-capes'.")
|
||||
|
||||
(defun +corfu--load-capes ()
|
||||
"Load all capes specified in `+corfu-global-capes'."
|
||||
(interactive)
|
||||
(when-let ((host (cl-intersection +corfu-capf-hosts completion-at-point-functions)))
|
||||
(setq-local
|
||||
completion-at-point-functions
|
||||
(cl-substitute
|
||||
(apply #'cape-super-capf (cl-substitute (car host) :completion (cl-pushnew :completion +corfu-global-capes)))
|
||||
(car host)
|
||||
completion-at-point-functions))))
|
||||
|
||||
(add-hook 'lsp-mode-hook #'+corfu--load-capes)
|
||||
(add-hook 'eglot-mode-hook #'+corfu--load-capes)
|
||||
(add-hook 'change-major-mode-hook #'+corfu--load-capes)
|
||||
|
||||
(use-package! corfu
|
||||
:custom
|
||||
(corfu-separator ?\s)
|
||||
(corfu-auto t)
|
||||
(corfu-auto-delay 0.2)
|
||||
(corfu-preview-current nil) ;; Disable current candidate preview
|
||||
(corfu-on-exact-match nil)
|
||||
(corfu-quit-no-match 'separator)
|
||||
(corfu-cycle t)
|
||||
(corfu-auto-prefix 2)
|
||||
(completion-cycle-threshold 1)
|
||||
(tab-always-indent 'complete)
|
||||
(corfu-max-width 80)
|
||||
(corfu-preselect-first nil)
|
||||
:hook
|
||||
(doom-first-buffer . global-corfu-mode)
|
||||
:config
|
||||
(when (modulep! +minibuffer)
|
||||
(add-hook 'minibuffer-setup-hook #'+corfu--enable-in-minibuffer))
|
||||
|
||||
;; Dirty hack to get c completion running
|
||||
;; Discussion in https://github.com/minad/corfu/issues/34
|
||||
(when (and (modulep! :lang cc)
|
||||
(equal tab-always-indent 'complete))
|
||||
(map! :map c-mode-base-map
|
||||
:i [remap c-indent-line-or-region] #'completion-at-point))
|
||||
|
||||
;; Reset lsp-completion provider
|
||||
(add-hook 'doom-init-modules-hook
|
||||
(lambda ()
|
||||
(after! lsp-mode
|
||||
(setq lsp-completion-provider :none))))
|
||||
|
||||
;; Set orderless filtering for LSP-mode completions
|
||||
;; TODO: expose a Doom variable to control this part
|
||||
(add-hook 'lsp-completion-mode-hook
|
||||
(lambda ()
|
||||
(setf (alist-get 'lsp-capf completion-category-defaults) '((styles . (orderless flex))))))
|
||||
|
||||
(defun corfu-move-to-minibuffer ()
|
||||
"Move current completions to the 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
|
||||
"C-SPC" #'corfu-insert-separator
|
||||
"C-n" #'corfu-next
|
||||
"C-p" #'corfu-previous
|
||||
"M-m" #'corfu-move-to-minibuffer
|
||||
(:prefix "C-x"
|
||||
"C-k" #'cape-dict
|
||||
"s" #'cape-ispell
|
||||
"C-n" #'cape-keyword
|
||||
"C-f" #'cape-file))
|
||||
(after! evil
|
||||
(advice-add 'corfu--setup :after 'evil-normalize-keymaps)
|
||||
(advice-add 'corfu--teardown :after 'evil-normalize-keymaps)
|
||||
(evil-make-overriding-map corfu-map))
|
||||
|
||||
(defadvice! +corfu--org-return (orig) :around '+org/return
|
||||
(if (and (modulep! :completion corfu)
|
||||
corfu-mode
|
||||
(>= corfu--index 0))
|
||||
(corfu-insert)
|
||||
(funcall orig)))
|
||||
|
||||
;; TODO: check how to deal with Daemon/Client workflow with that
|
||||
(unless (display-graphic-p)
|
||||
(corfu-doc-terminal-mode)
|
||||
(corfu-terminal-mode)))
|
||||
|
||||
(use-package! orderless
|
||||
:when (modulep! +orderless)
|
||||
:init
|
||||
(setq completion-styles '(orderless partial-completion)
|
||||
completion-category-defaults nil
|
||||
completion-category-overrides '((file (styles . (partial-completion))))))
|
||||
|
||||
(use-package! kind-icon
|
||||
:after corfu
|
||||
:when (modulep! +icons)
|
||||
:custom
|
||||
(kind-icon-default-face 'corfu-default)
|
||||
:config
|
||||
(setq kind-icon-use-icons t
|
||||
svg-lib-icons-dir (expand-file-name "svg-lib" doom-cache-dir)
|
||||
kind-icon-mapping
|
||||
'((array "a" :icon "code-brackets" :face font-lock-variable-name-face)
|
||||
(boolean "b" :icon "circle-half-full" :face font-lock-builtin-face)
|
||||
(class "c" :icon "view-grid-plus-outline" :face font-lock-type-face)
|
||||
(color "#" :icon "palette" :face success)
|
||||
(constant "co" :icon "pause-circle" :face font-lock-constant-face)
|
||||
(constructor "cn" :icon "table-column-plus-after" :face font-lock-function-name-face)
|
||||
(enum "e" :icon "format-list-bulleted-square" :face font-lock-builtin-face)
|
||||
(enum-member "em" :icon "format-list-checks" :face font-lock-builtin-face)
|
||||
(event "ev" :icon "lightning-bolt-outline" :face font-lock-warning-face)
|
||||
(field "fd" :icon "application-braces-outline" :face font-lock-variable-name-face)
|
||||
(file "f" :icon "file" :face font-lock-string-face)
|
||||
(folder "d" :icon "folder" :face font-lock-doc-face)
|
||||
(function "f" :icon "lambda" :face font-lock-function-name-face)
|
||||
(interface "if" :icon "video-input-component" :face font-lock-type-face)
|
||||
(keyword "kw" :icon "image-filter-center-focus" :face font-lock-keyword-face)
|
||||
(macro "mc" :icon "sigma" :face font-lock-keyword-face)
|
||||
(method "m" :icon "lambda" :face font-lock-function-name-face)
|
||||
(module "{" :icon "view-module" :face font-lock-preprocessor-face})
|
||||
(numeric "nu" :icon "numeric" :face font-lock-builtin-face)
|
||||
(operator "op" :icon "plus-circle-outline" :face font-lock-comment-delimiter-face)
|
||||
(param "pa" :icon "cog" :face default)
|
||||
(property "pr" :icon "tune-vertical" :face font-lock-variable-name-face)
|
||||
(reference "rf" :icon "bookmark-box-multiple" :face font-lock-variable-name-face)
|
||||
(snippet "S" :icon "text-short" :face font-lock-string-face)
|
||||
(string "s" :icon "sticker-text-outline" :face font-lock-string-face)
|
||||
(struct "%" :icon "code-braces" :face font-lock-variable-name-face)
|
||||
(t "." :icon "crosshairs-question" :face shadow)
|
||||
(text "tx" :icon "script-text-outline" :face shadow)
|
||||
(type-parameter "tp" :icon "format-list-bulleted-type" :face font-lock-type-face)
|
||||
(unit "u" :icon "ruler-square" :face shadow)
|
||||
(value "v" :icon "numeric-1-box-multiple-outline" :face font-lock-builtin-face)
|
||||
(variable "va" :icon "adjust" :face font-lock-variable-name-face)))
|
||||
(add-hook 'doom-load-theme-hook #'kind-icon-reset-cache)
|
||||
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
|
||||
|
||||
|
||||
(use-package! cape
|
||||
:defer t
|
||||
:init
|
||||
(map!
|
||||
[remap dabbrev-expand] 'cape-dabbrev)
|
||||
(add-hook! 'latex-mode-hook (defun +corfu--latex-set-capfs ()
|
||||
(add-to-list 'completion-at-point-functions #'cape-tex)))
|
||||
(when (modulep! :checkers spell)
|
||||
(add-to-list 'completion-at-point-functions #'cape-dict)
|
||||
(add-to-list 'completion-at-point-functions #'cape-ispell))
|
||||
(add-to-list 'completion-at-point-functions #'cape-file)
|
||||
(add-to-list 'completion-at-point-functions #'cape-keyword t)
|
||||
(add-to-list 'completion-at-point-functions #'cape-dabbrev t))
|
||||
|
||||
|
||||
(use-package! corfu-history
|
||||
:after corfu
|
||||
:hook (corfu-mode . (lambda ()
|
||||
(corfu-history-mode 1)
|
||||
(savehist-mode 1)
|
||||
(add-to-list 'savehist-additional-variables 'corfu-history))))
|
||||
|
||||
(use-package! corfu-quick
|
||||
:after corfu
|
||||
:bind (:map corfu-map
|
||||
("M-q" . corfu-quick-complete)
|
||||
("C-q" . corfu-quick-insert)))
|
||||
|
||||
(use-package! corfu-echo
|
||||
:after corfu
|
||||
:hook (corfu-mode . corfu-echo-mode))
|
||||
|
||||
|
||||
(use-package! corfu-info
|
||||
:after corfu)
|
||||
|
||||
|
||||
(use-package! corfu-popupinfo
|
||||
:after corfu
|
||||
:hook (corfu-mode . corfu-popupinfo-mode))
|
||||
|
||||
(when (modulep! :editor evil +everywhere)
|
||||
(setq evil-collection-corfu-key-themes '(default magic-return)))
|
||||
|
||||
(use-package! cape-yasnippet
|
||||
:after cape)
|
||||
|
||||
;; Override :config default mapping by waiting for after corfu is loaded
|
||||
(add-hook! 'doom-after-modules-config-hook
|
||||
(defun +corfu-unbind-yasnippet-h ()
|
||||
"Remove problematic tab bindings in cmds! on :i TAB"
|
||||
(map! :i [tab] nil
|
||||
:i "TAB" nil
|
||||
:i "C-SPC" #'completion-at-point
|
||||
:i "C-@" #'completion-at-point)))
|
20
modules/completion/corfu/packages.el
Normal file
20
modules/completion/corfu/packages.el
Normal file
|
@ -0,0 +1,20 @@
|
|||
(package! corfu
|
||||
:recipe (:files (:defaults "extensions/*.el")))
|
||||
|
||||
(when (modulep! +icons)
|
||||
(package! kind-icon))
|
||||
|
||||
(when (modulep! +orderless)
|
||||
(package! orderless))
|
||||
|
||||
(package! cape)
|
||||
|
||||
(package! popon
|
||||
:recipe (:type git :repo "https://codeberg.org/akib/emacs-popon"))
|
||||
(package! corfu-terminal
|
||||
:recipe (:type git :repo "https://codeberg.org/akib/emacs-corfu-terminal.git"))
|
||||
(package! corfu-doc-terminal
|
||||
:recipe (:type git :repo "https://codeberg.org/akib/emacs-corfu-doc-terminal.git"))
|
||||
|
||||
(package! cape-yasnippet
|
||||
:recipe (:host github :repo "elken/cape-yasnippet"))
|
BIN
modules/editor/.DS_Store
vendored
Normal file
BIN
modules/editor/.DS_Store
vendored
Normal file
Binary file not shown.
1
modules/editor/meow
Submodule
1
modules/editor/meow
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit e77073837591ab013588abb889392a5c23a00afb
|
Loading…
Add table
Add a link
Reference in a new issue