From 2adf6069f121e1d263b01bd7d7108a153992f250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Alvari=C3=B1o?= Date: Tue, 15 Mar 2022 01:03:08 +0100 Subject: [PATCH] Add Consult and Embark --- init.el | 28 ++++++++++----------- myconfig.org | 69 +++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 79 insertions(+), 18 deletions(-) diff --git a/init.el b/init.el index 35d8cad..4100424 100644 --- a/init.el +++ b/init.el @@ -1,12 +1,3 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; Keep emacs clean! -;; Change the user-emacs-directory to keep unwanted things out of ~/.emacs.d -(setq user-emacs-directory (expand-file-name "~/.cache/emacs/") - url-history-file (expand-file-name "url/history" user-emacs-directory)) - -(setq custom-file (expand-file-name "custom.el" user-emacs-directory)) - - ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; set up straight package manager (defvar bootstrap-version) @@ -25,6 +16,16 @@ (straight-use-package 'use-package) (setq straight-use-package-by-default t) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Keep emacs clean! +;; Change the user-emacs-directory to keep unwanted things out of ~/.emacs.d +(setq user-emacs-directory (expand-file-name "~/.cache/emacs/") + url-history-file (expand-file-name "url/history" user-emacs-directory)) +;; Use no-littering to automatically set common paths to the new user-emacs-directory +;; (use-package no-littering) +(setq custom-file (expand-file-name "custom.el" user-emacs-directory)) + + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Install org-mode (straight-use-package 'org) @@ -44,11 +45,10 @@ ;; (org-babel-load-file (f)))) - -;; Load configuration -;; Load myconfig.el unless there are changes in myconfig.org -(let ((config-el (expand-file-name "myconfig.el" user-emacs-directory)) - (config-org (expand-file-name "myconfig.org" user-emacs-directory))) +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Load myconfig file. +(let ((config-el (expand-file-name "~/.emacs.d/myconfig.el")) + (config-org (expand-file-name "~/.emacs.d/myconfig.org"))) (if (and (file-exists-p config-el) (time-less-p (file-attribute-modification-time (file-attributes config-org)) (file-attribute-modification-time (file-attributes config-el)))) diff --git a/myconfig.org b/myconfig.org index 3d3eb31..18a4372 100644 --- a/myconfig.org +++ b/myconfig.org @@ -109,6 +109,12 @@ (define-key own-map (kbd "e") 'aya-expand) #+end_src +** General (a new binding system) + Have a look at [[https://github.com/noctuid/general.el#key-features][doc]] + #+begin_src emacs-lisp + ;; (use-package general) + #+end_src + ** Syntax highlight Set maximum colors #+begin_src emacs-lisp @@ -137,7 +143,7 @@ ) #+end_src -* which-key +** which-key Some help with composed hotkeys #+begin_src emacs-lisp (use-package which-key @@ -148,7 +154,7 @@ ) #+end_src -* ace-windows +** ace-windows To jump to different windows easily #+begin_src emacs-lisp (use-package ace-window @@ -160,6 +166,14 @@ ) #+end_src +** PCRE2el + Perl Compatible Regexes + #+begin_src emacs-lisp + (use-package pcre2el + :config + (pcre-mode +1)) + #+end_src + * Completion systems ** Selectrum #+begin_src emacs-lisp @@ -215,12 +229,59 @@ ) #+end_src +* Consult and Embark + Consult is a collection of programs using emacs =completing-read= + You must read [[https://github.com/minad/consult][the doc]]! + #+begin_src emacs-lisp + (use-package consult + :bind + ("C-c h" . consult-history) + ("C-c m" . consult-mode-command) + ("C-c k" . consult-kmacro) + ;; C-x bindings (ctl-x-map) + ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command + ("C-x b" . consult-buffer) ;; orig. switch-to-buffer + ) + #+end_src -#+begin_src emacs_lisp -#+end_src +** Embark + [[https://github.com/oantolin/embark][The doc]] + #+begin_src emacs-lisp + (use-package embark + :bind + (("C-." . embark-act) ;; pick some comfortable binding + ("C-;" . embark-dwim) ;; good alternative: M-. + ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings' + + :init + + ;; Optionally replace the key help with a completing-read interface + (setq prefix-help-command #'embark-prefix-help-command) + + :config + ;; Hide the mode line of the Embark live/completions buffers + (add-to-list 'display-buffer-alist + '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" + nil + (window-parameters (mode-line-format . none)))) + ) + + ;; Consult users will also want the embark-consult package. + (use-package embark-consult + :after (embark consult) + :demand t ; only necessary if you have the hook below + ;; if you want to have consult previews as you move around an + ;; auto-updating embark collect buffer + :hook + (embark-collect-mode . consult-preview-at-point-mode)) + #+end_src + +* next +#+begin_src emacs-lisp +#+end_src * ivy - counsel - swipper An enhanced incremental search and a lot of features from counsel