config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

commit 1b92b901442ae6937995bd7987ec269aa3a30e99
parent 2941a7b712e9bc6c5a26730858c040b3a69790a3
Author: dwrz <dwrz@dwrz.net>
Date:   Tue, 12 Dec 2023 02:39:04 +0000

Update Emacs init

Diffstat:
Memacs/init.el | 95+++++++++++++++++++++++++++----------------------------------------------------
1 file changed, 32 insertions(+), 63 deletions(-)

diff --git a/emacs/init.el b/emacs/init.el @@ -147,8 +147,6 @@ (add-to-list 'completion-at-point-functions #'cape-history) (add-to-list 'completion-at-point-functions #'cape-sgml) (add-to-list 'completion-at-point-functions #'cape-rfc1345) - (add-to-list 'completion-at-point-functions #'cape-elisp-block) - (add-to-list 'completion-at-point-functions #'cape-elisp-symbol) :ensure t) (use-package cc-vars :config (setq-default c-basic-offset 8) :ensure nil) @@ -167,51 +165,15 @@ ("C-x b" . consult-buffer) ("C-x p b" . consult-project-buffer) ("C-x r b" . consult-bookmark) - ("C-h i" . consult-info)) - - ;; :bind (;; C-c bindings in `mode-specific-map' - ;; ("C-c M-x" . consult-mode-command) - ;; ("C-c h" . consult-history) - ;; ("C-c k" . consult-kmacro) - ;; ("C-c m" . consult-man) - ;; ("C-c i" . consult-info) - ;; ([remap Info-search] . consult-info) - ;; ;; C-x bindings in `ctl-x-map' - ;; ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command - ;; ;; Custom M-# bindings for fast register access - ;; ("M-#" . consult-register-load) - ;; ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated) - ;; ("C-M-#" . consult-register) - ;; ("M-y" . consult-yank-pop) ;; orig. yank-pop - ;; ;; M-g bindings in `goto-map' - ;; ("M-g e" . consult-compile-error) - ;; ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck - ;; ("M-g g" . consult-goto-line) ;; orig. goto-line - ;; ("M-g M-g" . consult-goto-line) ;; orig. goto-line - ;; ("M-g o" . consult-outline) ;; Alternative: consult-org-heading - ;; ("M-g m" . consult-mark) - ;; ("M-g k" . consult-global-mark) - ;; ("M-g i" . consult-imenu) - ;; ("M-g I" . consult-imenu-multi) - ;; ;; M-s bindings in `search-map' - ;; ("M-s d" . consult-find) ;; Alternative: consult-fd - ;; ("M-s g" . consult-grep) - ;; ("M-s G" . consult-git-grep) - ;; ("M-s r" . consult-ripgrep) - ;; ("M-s L" . consult-line-multi) - ;; ("M-s k" . consult-keep-lines) - ;; ("M-s u" . consult-focus-lines) - ;; ;; Isearch integration - ;; ("M-s e" . consult-isearch-history) - ;; :map isearch-mode-map - ;; ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string - ;; ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string - ;; ("M-s l" . consult-line) ;; needed by consult-line to detect isearch - ;; ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch - ;; ;; Minibuffer history - ;; :map minibuffer-local-map - ;; ("M-s" . consult-history) ;; orig. next-matching-history-element - ;; ("M-r" . consult-history)) ;; orig. previous-matching-history-element + ("C-h i" . consult-info) + ("M-y" . consult-yank-pop) + ("M-g i" . consult-imenu) + ("M-g I" . consult-imenu-multi) + ("M-g g" . consult-goto-line) + ("M-g M-g" . consult-goto-line) + :map minibuffer-local-map + ("M-s" . consult-history) + ("M-r" . consult-history)) :hook (completion-list-mode . consult-preview-at-point-mode) :init (setq register-preview-delay 0 @@ -220,10 +182,6 @@ (setq xref-show-xrefs-function #'consult-xref xref-show-definitions-function #'consult-xref) :config - ;; Optionally configure preview. The default value - ;; is 'any, such that any key triggers the preview. - ;; For some commands and buffer sources it is useful to configure the - ;; :preview-key on a per-command basis using the `consult-customize' macro. (consult-customize consult-theme :preview-key '(:debounce 0.2 any) consult-ripgrep consult-git-grep consult-grep @@ -231,14 +189,9 @@ consult--source-bookmark consult--source-file-register consult--source-recent-file consult--source-project-recent-file :preview-key '(:debounce 0.4 any)) - - ;; Optionally configure the narrowing key. - ;; Both < and C-+ work reasonably well. - (setq consult-narrow-key "<") ;; "C-+" - - ;; Optionally make narrowing help available in the minibuffer. - ;; You may want to use `embark-prefix-help-command' or which-key instead. - ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help) + (setq consult-narrow-key "<") + (define-key consult-narrow-map (vconcat consult-narrow-key "?") + #'consult-narrow-help) :ensure t) (use-package consult-lsp :ensure t) @@ -254,7 +207,7 @@ (corfu-cycle t) (corfu-scroll-margin 0) :ensure t - :hook (corfu-mode-hook . corfu-popupinfo-mode) + :hook (corfu-mode . corfu-popupinfo-mode) :init (global-corfu-mode) (setq tab-always-indent 'complete)) @@ -391,9 +344,9 @@ (use-package js :config (setq js-indent-level 2) - (setq-local indent-tabs-mode nil) :defines js-indent-level - :hook (js-mode . lsp) + :hook ((js-mode . lsp) + (js-mode . (lambda () (setq indent-tabs-mode nil)))) :ensure nil) (use-package ledger-mode :defer t :ensure t) @@ -417,6 +370,7 @@ message-kill-buffer-on-exit t message-sendmail-envelope-from 'header message-sendmail-f-is-evil nil) + :hook (message-mode . (lambda () (corfu-mode -1))) :defer t :ensure nil) @@ -657,7 +611,7 @@ :ensure t) (use-package prog-mode - :config (font-lock-add-keywords 'emacs-lisp-mode + :config (font-lock-add-keywords 'prog-mode '(("\\<\\(FIX\\|TODO\\|NB\\)" 1 font-lock-warning-face t))) :hook ((prog-mode . flycheck-mode) @@ -793,6 +747,20 @@ ("r" cape-rfc1345 "RFC 1345" :column "cape") ("w" cape-dict "dict" :column "cape")) +(defhydra hydra-consult (:color blue) + ("q" nil "quit" :column "quit") + ("a" (lambda () (interactive) (consult-notmuch-address t nil)) + "notmuch" :column "consult") + ("c" consult-mark "mark" :column "consult") + ("f" consult-find "find" :column "consult") + ("g" consult-grep "grep" :column "consult") + ("k" consult-global-mark "mark" :column "consult") + ("m" consult-line-multi "line-multi" :column "consult") + ("n" consult-notmuch "notmuch" :column "consult") + ("o" consult-org-heading "org" :column "consult") + ("r" consult-ripgrep "ripgrep" :column "consult") + ("v" consult-git-grep "git-grep" :column "consult")) + (defhydra hydra-highlight (:color blue) ("q" nil "quit" :column "highlight") ("s" highlight-symbol-at-point "symbol" :color blue :column "do") @@ -845,6 +813,7 @@ ("o" hydra-org/body "org" :column "hydras") ("p" hydra-point/body "point" :column "hydras") ("r" hydra-region/body "region" :column "hydras") + ("s" hydra-consult/body "consult" :column "hydras") ("w" hydra-windows/body "windows" :column "hydras")) ;; KEYBINDINGS