From 07e16d21090cb079e673e8f417a565d9703c21a1 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Thu, 7 Nov 2024 22:01:32 +0100 Subject: emacs: Various small tweaks --- .config/emacs/init.el | 1 + .config/emacs/modules/mm-abbrev.el | 11 ++++---- .config/emacs/modules/mm-completion.el | 48 ++++++++++++++++++++++++++++++---- .config/emacs/modules/mm-modeline.el | 11 ++++---- 4 files changed, 55 insertions(+), 16 deletions(-) diff --git a/.config/emacs/init.el b/.config/emacs/init.el index 6c72ae0..a48208f 100644 --- a/.config/emacs/init.el +++ b/.config/emacs/init.el @@ -175,6 +175,7 @@ buffer suppressed." (duplicate-region-final-position -1) (echo-keystrokes 0.01) ; 0 disables echoing (echo-keystrokes-help nil) + (extended-command-suggest-shorter nil) (help-window-select t) (initial-buffer-choice t) (initial-scratch-message mm-initial-scratch-message) diff --git a/.config/emacs/modules/mm-abbrev.el b/.config/emacs/modules/mm-abbrev.el index f484fc5..937d558 100644 --- a/.config/emacs/modules/mm-abbrev.el +++ b/.config/emacs/modules/mm-abbrev.el @@ -26,8 +26,7 @@ case-sensitive to avoid unexpected abbreviation expansions." ;;; Abbreviation Configuration (use-package abbrev - :init - (setq-default abbrev-mode t) + :hook prog-mode :custom (abbrev-file-name (expand-file-name "abbev-defs" mm-data-directory)) (save-abbrevs 'silently)) @@ -44,9 +43,9 @@ case-sensitive to avoid unexpected abbreviation expansions." "fpf" "fprintf" "fuf" "funlockfile" "pf" "printf" - "se" "stderr" - "si" "stdin" - "so" "stdout") + "sde" "stderr" + "sdi" "stdin" + "sdo" "stdout") (with-eval-after-load 'cc-mode (setq c-mode-abbrev-table (copy-abbrev-table mm-c-mode-abbrev-table) @@ -100,4 +99,4 @@ case-sensitive to avoid unexpected abbreviation expansions." #'tempel-complete -10 :local)))) (add-to-list 'auto-mode-alist (cons tempel-path #'lisp-data-mode))) -(provide 'mm-abbrev) +(provide 'mm-abbrev) \ No newline at end of file diff --git a/.config/emacs/modules/mm-completion.el b/.config/emacs/modules/mm-completion.el index bebc224..85763b7 100644 --- a/.config/emacs/modules/mm-completion.el +++ b/.config/emacs/modules/mm-completion.el @@ -9,7 +9,13 @@ :custom (vertico-cycle t) :config - (require 'hl-line)) + (require 'hl-line) + ;; When working with ‘file-name-shadow-mode’ enabled, if I shadow old + ;; input (i.e.) by typing ‘~/’ after ‘foo/bar’ Vertico will clear the + ;; old path to keep only the current input (the old path is hidden by + ;; ‘rfn-shadow’ anyways). + (with-eval-after-load 'rfn-shadow + (add-hook 'rfn-shadow-update-overlay-hook #'vertico-directory-tidy))) ;;; Annotate Completions @@ -19,7 +25,8 @@ :ensure t :hook after-init :custom - (marginalia-field-width 50)) + (marginalia-field-width 50) + (marginalia-max-relative-age 0)) ;;; Minibuffer Completion Styles @@ -90,6 +97,7 @@ (corfu-cycle t) (corfu-auto-prefix 1) (corfu-auto-delay .1) + (corfu-min-width 20) :config ;; I complete with RET and this interferes with ‘tempel-next’ (keymap-unset corfu-map "TAB" :remove) @@ -101,7 +109,12 @@ ;;; Save Minibuffer History (use-package savehist-mode - :hook (after-init . savehist-mode)) + :hook (after-init . savehist-mode) + :custom + (history-length 200) + (history-delete-duplicates t) + :config + (add-to-list 'savehist-additional-variables 'kill-ring)) ;;; Enhanced Replacements for Builtins @@ -109,17 +122,42 @@ ;; TODO: Investigate other commands (use-package consult :ensure t + :hook (completion-list-mode . consult-preview-at-point-mode) :bind ( ([remap switch-to-buffer] . consult-buffer) ([remap imenu] . consult-imenu) ([remap goto-line] . consult-goto-line) + ("M-F" . consult-focus-lines) + :map project-prefix-map + ("b" . consult-project-buffer) :map consult-narrow-map ("?" . consult-narrow-help)) + :custom + (consult-find-args + (string-join + '("find . -not (" + " -path '*/.git*' -prune" + " -or -path '*/vendor/*' -prune" + ")") + " ")) :config - (with-eval-after-load 'project - (keymap-set project-prefix-map "b" #'consult-project-buffer)) (with-eval-after-load 'pulsar (setopt consult-after-jump-hook nil) (dolist (command #'(pulsar-recenter-top pulsar-reveal-entry)) (add-hook 'consult-after-jump-hook command)))) + +;;; Dynamic Abbreviations + +(use-package dabbrev + :commands (dabbrev-completion dabbrev-expand) + :custom + (dabbrev-upcase-means-case-search t)) + + +;;; Finding Things + +(use-package find-func + :custom + (find-library-include-other-files nil)) + (provide 'mm-completion) \ No newline at end of file diff --git a/.config/emacs/modules/mm-modeline.el b/.config/emacs/modules/mm-modeline.el index 77be12e..2b3775e 100644 --- a/.config/emacs/modules/mm-modeline.el +++ b/.config/emacs/modules/mm-modeline.el @@ -76,11 +76,12 @@ (mm-modeline--define-component mm-modeline-major-mode-symbol (propertize (cond - ((derived-mode-p 'comint-mode) "$ ") - ((derived-mode-p 'conf-mode) "# ") - ((derived-mode-p 'prog-mode) "λ ") - ((derived-mode-p 'text-mode) "§ ") - (t "")) + ((derived-mode-p 'comint-mode) "$ ") + ((derived-mode-p 'conf-mode) "# ") + ((derived-mode-p 'prog-mode) "λ ") + ((derived-mode-p 'special-mode) "❇ ") + ((derived-mode-p 'text-mode) "§ ") + (:default "")) 'face 'mm-modeline-major-mode-symbol-face)) (mm-modeline--define-component mm-modeline-narrow -- cgit v1.2.3