From 91404b31962b97d3dc41002d1e4e3ef7e7b12760 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Tue, 3 Jun 2025 17:36:14 +0200 Subject: [PATCH] Move completion related packages from configuration.org to init.el --- configuration.org | 163 ---------------------------------------------- init.el | 131 +++++++++++++++++++++++++++++++++++++ 2 files changed, 131 insertions(+), 163 deletions(-) diff --git a/configuration.org b/configuration.org index f5e094b..5345d47 100644 --- a/configuration.org +++ b/configuration.org @@ -88,169 +88,6 @@ Rainbow to the stars… ("K" . dired-k))) #+end_src -* Completion related external packages - -** ~vertico~ - -#+begin_src emacs-lisp -(use-package vertico - :init - (vertico-mode)) -#+end_src - -** ~consult~ - -#+begin_src emacs-lisp -(use-package consult - :bind (:map global-map - ([remap Info-search] . consult-info) - ("M-y" . consult-yank-pop) - :map ctl-x-map - ("M-:" . consult-complex-command) - ("4 b" . consult-buffer-other-window) - ("5 b" . consult-buffer-other-frame) - ("b" . consult-buffer) - ("r b" . consult-bookmark) - ("x b" . consult-project-buffer) - :map goto-map - ("e" . consult-compile-error) - ("F" . consult-flymake) - ("g" . consult-goto-line) - ("M-g" . consult-goto-line) - ("i" . consult-imenu) - ("I" . consult-imenu-multi) - ("k" . consult-global-mark) - ("m" . consult-mark) - ("o" . consult-org-heading) - :map search-map - ("d" . consult-find) - ("D" . consult-locate) - ("e" . consult-isearch-history) - ("k" . consult-keep-lines) - ("l" . consult-line) - ("L" . consult-line-multi) - :map isearch-mode-map - ("M-e" . consult-isearch-history) - :map minibuffer-local-map - ("M-s" . consult-history) - ("M-r" . consult-history)) - :hook - (completion-list-mode . consult-preview-at-point-mode) - :custom - (consult-narrow-key "<") - (consult-project-function (lambda (_) (projectile-project-root))) - (register-preview-delay 0.5) - (xref-show-xrefs-function #'consult-xref) - (xref-show-definitions-function #'consult-xref) - :init - (setq register-preview-function #'consult-register-format) - (advice-add #'register-preview :override #'consult-register-window) - :config - (defalias 'consult-line-thing-at-point 'consult-line) - (consult-customize - consult-theme :preview-key '(:debounce 0.2 any) - consult-buffer :preview-key "M-." - consult-line-thing-at-point :initial (thing-at-point 'symbol) - consult-ripgrep - consult-git-grep - consult-grep - consult-bookmark - consult-recent-file - consult-xref - consult--source-bookmark - consult--source-file-register - consult--source-recent-file - consult--source-project-recent-file - :preview-key '(:debounce 0.4 any)) - (autoload 'projectile-project-root "projectile")) -#+end_src - -** ~orderless~ - -#+begin_src emacs-lisp -(use-package orderless - :init - (setq completion-category-defaults nil) - :custom - (completion-styles '(orderless basic)) - (completion-category-defaults nil) - (completion-category-overrides '((file (styles basic partial-completion))))) -#+end_src - -** ~marginalia~ - -#+begin_src emacs-lisp -(use-package marginalia - :bind (:map minibuffer-local-map - ("M-A" . marginalia-cycle)) - :init - (marginalia-mode)) -#+end_src - -** ~embark~ - -#+begin_src emacs-lisp -(use-package embark - :bind (:map global-map - ("C-." . embark-act)) - :config - (add-to-list 'display-buffer-alist - '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" - nil - (window-parameters (mode-line-format . none))))) - -(use-package embark-consult - :hook - (embark-collect-mode . consult-preview-at-point-mode)) -#+end_src - -** ~consult-projectile~ - -#+begin_src emacs-lisp -(use-package consult-projectile - :demand t - :after (:all projectile consult embark) - :config - (defvar-keymap embark-consult-projectile-project-map - :doc "Keymap to use for the projectile menu" - :parent embark-general-map - "g" #'magit-status) - (add-to-list 'embark-keymap-alist '(consult-projectile-project embark-consult-projectile-project-map)) - (autoload 'magit-status "magit") - :bind (:map projectile-command-map - ("p" . consult-projectile-switch-project))) -#+end_src - -** ~corfu~ - -#+begin_src emacs-lisp -(use-package corfu - :init - (global-corfu-mode) - :custom - (corfu-cycle t) - (corfu-separator ?\s)) -#+end_src - -** ~cape~ - -#+begin_src emacs-lisp -(defvar gpolonkai/completion-at-point-map (make-sparse-keymap) - "Map for traspose functions.") -(define-prefix-command 'gpolonkai/completion-at-point-map) - -(use-package cape - :bind (:map gpolonkai/completion-at-point-map - ("p" . completion-at-point) - :map gpolonkai/pers-map - ("p" . gpolonkai/completion-at-point-map)) - :init - (add-to-list 'completion-at-point-functions #'cape-dabbrev) - (add-to-list 'completion-at-point-functions #'cape-file) - (add-to-list 'completion-at-point-functions #'cape-elisp-block) - (add-to-list 'completion-at-point-functions #'cape-elisp-symbol)) -#+end_src - * Mailing ** Set up whitespace handling in mu4e buffers diff --git a/init.el b/init.el index e990d88..5db07ac 100644 --- a/init.el +++ b/init.el @@ -1245,6 +1245,137 @@ order." :bind (([f6] . git-timemachine-toggle))) +;; Completion related external packages + +(use-package vertico + :init + (vertico-mode)) + +(use-package consult + :bind (:map global-map + ([remap Info-search] . consult-info) + ("M-y" . consult-yank-pop) + :map ctl-x-map + ("M-:" . consult-complex-command) + ("4 b" . consult-buffer-other-window) + ("5 b" . consult-buffer-other-frame) + ("b" . consult-buffer) + ("r b" . consult-bookmark) + ("x b" . consult-project-buffer) + :map goto-map + ("e" . consult-compile-error) + ("F" . consult-flymake) + ("g" . consult-goto-line) + ("M-g" . consult-goto-line) + ("i" . consult-imenu) + ("I" . consult-imenu-multi) + ("k" . consult-global-mark) + ("m" . consult-mark) + ("o" . consult-org-heading) + :map search-map + ("d" . consult-find) + ("D" . consult-locate) + ("e" . consult-isearch-history) + ("k" . consult-keep-lines) + ("l" . consult-line) + ("L" . consult-line-multi) + :map isearch-mode-map + ("M-e" . consult-isearch-history) + :map minibuffer-local-map + ("M-s" . consult-history) + ("M-r" . consult-history)) + :hook + (completion-list-mode . consult-preview-at-point-mode) + :custom + (consult-narrow-key "<") + (consult-project-function (lambda (_) (projectile-project-root))) + (register-preview-delay 0.5) + (xref-show-xrefs-function #'consult-xref) + (xref-show-definitions-function #'consult-xref) + :init + (setq register-preview-function #'consult-register-format) + (advice-add #'register-preview :override #'consult-register-window) + :config + (defalias 'consult-line-thing-at-point 'consult-line) + (consult-customize + consult-theme :preview-key '(:debounce 0.2 any) + consult-buffer :preview-key "M-." + consult-line-thing-at-point :initial (thing-at-point 'symbol) + consult-ripgrep + consult-git-grep + consult-grep + consult-bookmark + consult-recent-file + consult-xref + consult--source-bookmark + consult--source-file-register + consult--source-recent-file + consult--source-project-recent-file + :preview-key '(:debounce 0.4 any)) + (autoload 'projectile-project-root "projectile")) + +(use-package orderless + :init + (setq completion-category-defaults nil) + :custom + (completion-styles '(orderless basic)) + (completion-category-defaults nil) + (completion-category-overrides '((file (styles basic partial-completion))))) + +(use-package marginalia + :bind (:map minibuffer-local-map + ("M-A" . marginalia-cycle)) + :init + (marginalia-mode)) + +(use-package embark + :bind (:map global-map + ("C-." . embark-act)) + :config + (add-to-list 'display-buffer-alist + '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" + nil + (window-parameters (mode-line-format . none))))) + +(use-package embark-consult + :hook + (embark-collect-mode . consult-preview-at-point-mode)) + +(use-package consult-projectile + :demand t + :after (:all projectile consult embark) + :config + (defvar-keymap embark-consult-projectile-project-map + :doc "Keymap to use for the projectile menu" + :parent embark-general-map + "g" #'magit-status) + (add-to-list 'embark-keymap-alist '(consult-projectile-project embark-consult-projectile-project-map)) + (autoload 'magit-status "magit") + :bind (:map projectile-command-map + ("p" . consult-projectile-switch-project))) + +(use-package corfu + :init + (global-corfu-mode) + :custom + (corfu-cycle t) + (corfu-separator ?\s)) + +(defvar gpolonkai/completion-at-point-map (make-sparse-keymap) + "Map for traspose functions.") +(define-prefix-command 'gpolonkai/completion-at-point-map) + +(use-package cape + :bind (:map gpolonkai/completion-at-point-map + ("p" . completion-at-point) + :map gpolonkai/pers-map + ("p" . gpolonkai/completion-at-point-map)) + :init + (add-to-list 'completion-at-point-functions #'cape-dabbrev) + (add-to-list 'completion-at-point-functions #'cape-file) + (add-to-list 'completion-at-point-functions #'cape-elisp-block) + (add-to-list 'completion-at-point-functions #'cape-elisp-symbol)) + ;; I started moving my configuration to this Org file. It’s easier to document this way. (org-babel-load-file (expand-file-name "configuration.org" user-emacs-directory))