From e0812d171c2cb6f71822357046068a261bd121e4 Mon Sep 17 00:00:00 2001 From: bh Date: Sat, 13 Dec 2025 22:59:49 +0800 Subject: Added Dashboard --- config/banner.txt | 1 + config/completion.el | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++ config/dashboard.el | 41 ++++++++++++++++++ 3 files changed, 158 insertions(+) create mode 100644 config/banner.txt create mode 100644 config/completion.el create mode 100644 config/dashboard.el (limited to 'config') diff --git a/config/banner.txt b/config/banner.txt new file mode 100644 index 0000000..cac82ba --- /dev/null +++ b/config/banner.txt @@ -0,0 +1 @@ + diff --git a/config/completion.el b/config/completion.el new file mode 100644 index 0000000..f723966 --- /dev/null +++ b/config/completion.el @@ -0,0 +1,116 @@ +;; Completion Framework - Vertico + Consult + Marginalia + Orderless +;; Modern, minimal completion system based on Emacs' built-in completing-read + +;; ===================================== +;; Vertico - Vertical completion UI +;; ===================================== +(use-package vertico + :init + (vertico-mode 1) + :config + ;; Cycle through candidates + (setq vertico-cycle t) + ;; Number of candidates to display + (setq vertico-count 15)) + +;; ===================================== +;; Orderless - Flexible completion style +;; ===================================== +(use-package orderless + :config + ;; Use orderless for completion + (setq completion-styles '(orderless basic) + completion-category-defaults nil + completion-category-overrides '((file (styles partial-completion))))) + +;; ===================================== +;; Marginalia - Rich annotations +;; ===================================== +(use-package marginalia + :init + (marginalia-mode 1) + :config + ;; Bind in minibuffer to toggle annotations + (define-key minibuffer-local-map (kbd "M-A") 'marginalia-cycle)) + +;; ===================================== +;; Consult - Enhanced commands +;; ===================================== +(use-package consult + :bind + (;; C-c bindings (mode-specific-map) + ("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) + ("C-x b" . consult-buffer) ;; Replace switch-to-buffer + ("C-x 4 b" . consult-buffer-other-window) + ("C-x 5 b" . consult-buffer-other-frame) + ("C-x r b" . consult-bookmark) + + ;; M-g bindings (goto-map) + ("M-g e" . consult-compile-error) + ("M-g f" . consult-flymake) + ("M-g g" . consult-goto-line) + ("M-g M-g" . consult-goto-line) + ("M-g o" . consult-outline) + ("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 (search-map) + ("M-s d" . consult-find) + ("M-s D" . consult-locate) + ("M-s g" . consult-grep) + ("M-s G" . consult-git-grep) + ("M-s r" . consult-ripgrep) + ("M-s l" . consult-line) + ("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) + ("M-s e" . consult-isearch-history) + ("M-s l" . consult-line) + ("M-s L" . consult-line-multi) + + ;; Minibuffer history + :map minibuffer-local-map + ("M-s" . consult-history) + ("M-r" . consult-history)) + + :config + ;; Preview configuration + (setq consult-preview-key 'any) ;; Preview as you type + + ;; Narrowing configuration + (setq consult-narrow-key "<")) ;; Use < to narrow + +;; ===================================== +;; Embark - Actions on candidates +;; ===================================== +(use-package embark + :bind + (("C-." . embark-act) ;; Pick an action using completion + ("C-;" . embark-dwim) ;; Good alternative: M-. + ("C-h B" . embark-bindings)) ;; Alternative for `describe-bindings' + :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))))) + +;; Embark + Consult integration +(use-package embark-consult + :after (embark consult) + :hook + (embark-collect-mode . consult-preview-at-point-mode)) + +(provide 'completion) diff --git a/config/dashboard.el b/config/dashboard.el new file mode 100644 index 0000000..f5496ce --- /dev/null +++ b/config/dashboard.el @@ -0,0 +1,41 @@ +;; Dashboard - Startup screen +(use-package dashboard + :config + ;; Use text banner from file + (setq dashboard-startup-banner (expand-file-name "config/banner.txt" user-emacs-directory)) + (setq dashboard-banner-logo-title "In the Beginning was the Word, and the Word was with EMACS,\nand the Word was EMACS...") + + ;; Customize the text banner face to make icon HUGE + (set-face-attribute 'dashboard-text-banner nil + :height 15.0 + :foreground "#8057b6") + + ;; Customize the title face + (set-face-attribute 'dashboard-banner-logo-title nil + :height 1.2 + :foreground "#8affff" + :weight 'bold) + + ;; Center content + (setq dashboard-center-content t) + (setq dashboard-vertically-center-content t) + + ;; Disable shortcut indicators + (setq dashboard-show-shortcuts nil) + + ;; Customize dashboard items + (setq dashboard-items '((recents . 5) + (bookmarks . 5) + (projects . 5) + (agenda . 5) + (registers . 5))) + (setq dashboard-item-shortcuts '((recents . "r") + (bookmarks . "m") + (projects . "p") + (agenda . "a") + (registers . "e"))) + + ;; Set up the startup hook + (dashboard-setup-startup-hook)) + +(provide 'dashboard) -- cgit v1.2.3