diff --git a/users/crumb/programs/emacs/init.el b/users/crumb/programs/emacs/init.el index 6958ef6..7dfb9a8 100644 --- a/users/crumb/programs/emacs/init.el +++ b/users/crumb/programs/emacs/init.el @@ -11,8 +11,9 @@ (add-to-list 'load-path (file-name-concat user-emacs-directory "modules")) (add-to-list 'load-path (file-name-concat user-emacs-directory "lib")) -(require 'syd-autosave) (require 'syd-age) +(require 'syd-autosave) +(require 'syd-completion) (require 'syd-display-startup-time) (require 'syd-evil) (require 'syd-keybinds) diff --git a/users/crumb/programs/emacs/modules/syd-completion.el b/users/crumb/programs/emacs/modules/syd-completion.el new file mode 100644 index 0000000..87d4b64 --- /dev/null +++ b/users/crumb/programs/emacs/modules/syd-completion.el @@ -0,0 +1,49 @@ +;;; syd-completion.el -*- lexical-binding: t; -*- + +(use-package emacs + :custom + ;; Allow the opening of new minibuffers from inside existing minibuffers. + ((enable-recursive-minibuffers t) + ;; Hide commands in M-x which do not work in the current mode. + (read-extended-command-predicate #'command-completion-default-include-p)) + :config + ;; Disable blinking cursor. Aesthetically, I personally don't fancy it; + ;; technically, it doesn't play well with `evil-terminal-cursor-changer'. + (blink-cursor-mode -1)) + +;; Consult adds various search and navigation tools using Emacs' completing-read +;; function; i.e., in our case, Vertico. +(use-package consult + :defer t) + +;; Vertico is a simple completion engine that replaces Emacs' built-in +;; completion engine, achieving Just Works™ compatibility. This is in contrast +;; to e.g. Helm and Ivy, which spawn ecosystems orthogonal to Emacs, and +;; diametrically-opposed to each other. +(use-package vertico + :hook (on-first-input . vertico-mode) + :general (:keymaps 'vertico-map + "DEL" #'vertico-directory-delete-char + "C-SPC" #'+vertico/embark-preview + "C-j" #'vertico-next + "C-k" #'vertico-previous + "C-M-j" #'vertico-next-group + "C-M-k" #'vertico-previous-group) + :config + (setq-default completion-in-region-function #'consult-completion-in-region) + ;; Cleans up path when moving directories with shadowed paths syntax, e.g. + ;; cleans ~/foo/bar/// to /, and ~/foo/bar/~/ to ~/. + (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)) + +;; Orderless provides a completion style that divides the pattern into +;; space-separated components, and matches candidates that match all of the +;; components in any order. Each component can match in any one of several +;; ways: literally, as a regexp, as an initialism, in the flex style, or as +;; multiple word prefixes. By default, regexp and literal matches are enabled. +(use-package orderless + :custom ((completion-styles '(orderless basic)) + (completion-category-overrides + '((file (styles basic partial-completion)))))) + + +(provide 'syd-completion) diff --git a/users/crumb/programs/emacs/modules/syd-ui.el b/users/crumb/programs/emacs/modules/syd-ui.el index a3dbff9..4478f45 100644 --- a/users/crumb/programs/emacs/modules/syd-ui.el +++ b/users/crumb/programs/emacs/modules/syd-ui.el @@ -5,49 +5,4 @@ :config (load-theme 'kanagawa-wave t)) -(use-package emacs - :custom - ;; Allow the opening of new minibuffers from inside existing minibuffers. - ((enable-recursive-minibuffers t) - ;; Hide commands in M-x which do not work in the current mode. - (read-extended-command-predicate #'command-completion-default-include-p)) - :config - ;; Disable blinking cursor. Aesthetically, I personally don't fancy it; - ;; technically, it doesn't play well with `evil-terminal-cursor-changer'. - (blink-cursor-mode -1)) - -;; Consult adds various search and navigation tools using Emacs' completing-read -;; function; i.e., in our case, Vertico. -(use-package consult - :defer t) - -;; Vertico is a simple completion engine that replaces Emacs' built-in -;; completion engine, achieving Just Works™ compatibility. This is in contrast -;; to e.g. Helm and Ivy, which spawn ecosystems orthogonal to Emacs, and -;; diametrically-opposed to each other. -(use-package vertico - :hook (on-first-input . vertico-mode) - :general (:keymaps 'vertico-map - "DEL" #'vertico-directory-delete-char - "C-SPC" #'+vertico/embark-preview - "C-j" #'vertico-next - "C-k" #'vertico-previous - "C-M-j" #'vertico-next-group - "C-M-k" #'vertico-previous-group) - :config - (setq-default completion-in-region-function #'consult-completion-in-region) - ;; Cleans up path when moving directories with shadowed paths syntax, e.g. - ;; cleans ~/foo/bar/// to /, and ~/foo/bar/~/ to ~/. - (add-hook 'rfn-eshadow-update-overlay-hook #'vertico-directory-tidy)) - -;; Orderless provides a completion style that divides the pattern into -;; space-separated components, and matches candidates that match all of the -;; components in any order. Each component can match in any one of several -;; ways: literally, as a regexp, as an initialism, in the flex style, or as -;; multiple word prefixes. By default, regexp and literal matches are enabled. -(use-package orderless - :custom ((completion-styles '(orderless basic)) - (completion-category-overrides - '((file (styles basic partial-completion)))))) - (provide 'syd-ui)