From 891960df1400a9aa5f76fec502e52591e9350931 Mon Sep 17 00:00:00 2001 From: bh Date: Mon, 15 Dec 2025 22:04:22 +0800 Subject: Added icons to Dired --- config/dashboard.el | 18 ++++++ config/eshell.el | 0 config/projectile.el | 24 ++++++++ config/treemacs.el | 5 ++ early-init.el | 9 ++- init.el | 169 ++++++++++++++++++++++++++++----------------------- 6 files changed, 148 insertions(+), 77 deletions(-) create mode 100644 config/eshell.el create mode 100644 config/projectile.el diff --git a/config/dashboard.el b/config/dashboard.el index f5496ce..a9c07b5 100644 --- a/config/dashboard.el +++ b/config/dashboard.el @@ -1,4 +1,5 @@ ;; Dashboard - Startup screen + (use-package dashboard :config ;; Use text banner from file @@ -16,6 +17,23 @@ :foreground "#8affff" :weight 'bold) + ;; Customize section heading colors (Recent Files, Projects, etc.) + (set-face-attribute 'dashboard-heading nil + :foreground "#ffc600" + :weight 'bold) + + ;; Enable Nerd Font icons + (setq dashboard-icon-type 'nerd-icons) + (setq dashboard-set-heading-icons t) + (setq dashboard-set-file-icons t) + + ;; Customize heading icons (optional - comment out to use defaults) + (setq dashboard-heading-icons '((recents . "nf-oct-history") + (bookmarks . "nf-oct-bookmark") + (projects . "nf-oct-rocket") + (agenda . "nf-oct-calendar") + (registers . "nf-oct-database"))) + ;; Center content (setq dashboard-center-content t) (setq dashboard-vertically-center-content t) diff --git a/config/eshell.el b/config/eshell.el new file mode 100644 index 0000000..e69de29 diff --git a/config/projectile.el b/config/projectile.el new file mode 100644 index 0000000..4e9ab71 --- /dev/null +++ b/config/projectile.el @@ -0,0 +1,24 @@ +;; Projectile - Project management + +(use-package projectile + :config + ;; Enable projectile globally + (projectile-mode +1) + + ;; Set project search path (where your projects live) + (setq projectile-project-search-path '("~/projects" "~/.config")) + + ;; Cache project files for better performance + (setq projectile-enable-caching t) + + ;; Keybindings + :bind-keymap + ("C-c p" . projectile-command-map) + + :bind + ; (("C-c p f" . projectile-find-file) ;; Find file in project + ; ("C-c p p" . projectile-switch-project) ;; Switch between projects + ; ("C-c p s" . projectile-ripgrep))) ;; Search in project + ) + +(provide 'projectile) diff --git a/config/treemacs.el b/config/treemacs.el index e6acc95..92baa84 100644 --- a/config/treemacs.el +++ b/config/treemacs.el @@ -55,3 +55,8 @@ (set-face-attribute 'treemacs-nerd-icons-file-face nil :foreground "#74c4c4" :inherit 'unspecified)) + +;; Dired integration - adds nerd-icons to dired buffers +(use-package nerd-icons-dired + :hook + (dired-mode . nerd-icons-dired-mode)) diff --git a/early-init.el b/early-init.el index c8b5b5f..6856ba8 100644 --- a/early-init.el +++ b/early-init.el @@ -7,6 +7,12 @@ ;; Maximize GC threshold during startup (restored in init.el) (setq gc-cons-threshold most-positive-fixnum) +(add-hook 'emacs-startup-hook + (lambda () + (setq gc-cons-threshold (* 16 1024 1024)))) + +(setq native-comp-deferred-compilation t) + ;; ===================================== ;; 🎨 Terafox Theme @@ -16,7 +22,6 @@ (add-to-list 'custom-theme-load-path (expand-file-name "themes" user-emacs-directory)) (load-theme 'terafox-emacs t) - ;; ===================================== ;; 🎨 UI Configuration (Pre-GUI Init) ;; ===================================== @@ -24,7 +29,7 @@ ;; Configure frame appearance BEFORE GUI initializes ;; This prevents the white flash on startup (setq default-frame-alist - '((font . "JetBrainsMono Nerd Font-10.5:weight=semi-bold:antialias=true:hinting=true:hintstyle=slight") + '((font . "JetBrainsMono Nerd Font-10.5:weight=semi-bold:antialias=true:hinting=true:hintstyle=slight") (background-color . "#003636") ;; Dark cyan background (foreground-color . "#8affff") ;; Bright cyan text (alpha-background . 75) ;; 75% opacity (GUI only) diff --git a/init.el b/init.el index 45e1c0b..4a593a7 100644 --- a/init.el +++ b/init.el @@ -19,19 +19,19 @@ ;; Bootstrap straight.el from XDG config directory (defvar bootstrap-version) (let* ((user-dir (file-name-as-directory - (or (getenv "XDG_CONFIG_HOME") "~/.config/"))) - (emacs-dir (concat user-dir "emacs/")) - (bootstrap-file + (or (getenv "XDG_CONFIG_HOME") "~/.config/"))) + (emacs-dir (concat user-dir "emacs/")) + (bootstrap-file (expand-file-name "straight/repos/straight.el/bootstrap.el" emacs-dir)) - (bootstrap-version 6)) - (unless (file-exists-p bootstrap-file) + (bootstrap-version 6)) +(unless (file-exists-p bootstrap-file) (with-current-buffer (url-retrieve-synchronously "https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el" 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) + (goto-char (point-max)) + (eval-print-last-sexp))) +(load bootstrap-file nil 'nomessage)) ;; Freeze File (setq straight-freeze-file (expand-file-name "versions.el" user-emacs-directory)) @@ -44,6 +44,14 @@ (use-package diminish) ;; Hide/abbreviate minor modes (use-package bind-key) ;; Key binding utilities +;; Nerd Icons - icon library (must be loaded early) +(use-package nerd-icons + :if (display-graphic-p)) + +;; All The Icons - alternative icon library (for compatibility) +(use-package all-the-icons + :if (display-graphic-p)) + ;; ===================================== ;; 🎨 UI & Visual Configuration ;; ===================================== @@ -58,9 +66,9 @@ ;; Disable startup messages and bell (setq inhibit-startup-screen t - inhibit-startup-message t - inhibit-startup-echo-area-message t - ring-bell-function 'ignore) + inhibit-startup-message t + inhibit-startup-echo-area-message t + ring-bell-function 'ignore) ;; Configure line numbers with themed colors ;; Only show line numbers in text/code buffers, not special buffers (treemacs, magit, etc.) @@ -68,35 +76,35 @@ (add-hook 'text-mode-hook 'display-line-numbers-mode) (setq display-line-numbers-type 'relative) ;; Relative line numbers for Evil mode (set-face-attribute 'line-number nil - :foreground "#4fa8a8" ;; Softer cyan for line numbers - :background "#003636") + :foreground "#4fa8a8" ;; Softer cyan for line numbers + :background "#003636") (set-face-attribute 'line-number-current-line nil - :foreground "#8affff" ;; Bright cyan for current line - :background "#003636" - :weight 'bold) + :foreground "#8affff" ;; Bright cyan for current line + :background "#003636" + :weight 'bold) (set-face-attribute 'fringe nil :background "#003636") ;; Configure cursor and selection colors (set-face-attribute 'cursor nil - :background "#FFC600") ;; Yellow/gold cursor + :background "#FFC600") ;; Yellow/gold cursor (set-face-attribute 'region nil - :background "#395e5e" ;; Dark teal selection - :foreground 'unspecified) ;; Keep text color unchanged + :background "#395e5e" ;; Dark teal selection + :foreground 'unspecified) ;; Keep text color unchanged ;; Configure mode-line colors (set-face-attribute 'mode-line nil - :background "#004344" ;; Dark teal background - :foreground "#8affff" ;; Bright cyan text - :box nil) ;; Remove border + :background "#004344" ;; Dark teal background + :foreground "#8affff" ;; Bright cyan text + :box nil) ;; Remove border ;;:box '(:line-width 3 :color "#004344")) ;; Add padding for icons (set-face-attribute 'mode-line-inactive nil - :background "#003030" ;; Darker background for inactive - :foreground "#808080" ;; Gray text for inactive - :box nil) ;; Remove border + :background "#003030" ;; Darker background for inactive + :foreground "#808080" ;; Gray text for inactive + :box nil) ;; Remove border ;; Configure window divider color (between buffers) (set-face-attribute 'vertical-border nil - :foreground "#74c4c4") ;; Window divider color + :foreground "#74c4c4") ;; Window divider color ;; Configure internal border (gray bar around frame in GUI) ;; (set-face-attribute 'internal-border nil @@ -104,9 +112,9 @@ ;; Configure header-line (bar at top of buffers like C-x C-b) (set-face-attribute 'header-line nil - :background "#002323" - :foreground "#8affff" - :box nil) + :background "#002323" + :foreground "#8affff" + :box nil) ;; ===================================== ;; 🔧 Editing Behavior @@ -118,6 +126,11 @@ ;; Enable electric-indent for auto-indenting on RET (electric-indent-mode 1) +;; Track recently opened files for dashboard +(recentf-mode 1) +(setq recentf-max-saved-items 50) ;; Save up to 50 recent files +(setq recentf-max-menu-items 15) ;; Show 15 in menu + ;; ===================================== ;; I LOVE TABS ;; ===================================== @@ -132,11 +145,11 @@ ;; Enforce tabs in all major modes (many modes override indent-tabs-mode) (defun enforce-tabs () - "Force use of tabs for indentation in all modes." - (setq indent-tabs-mode t) - (setq tab-width 4) - ;; Make TAB key insert a tab character instead of smart-indenting - (local-set-key (kbd "TAB") 'tab-to-tab-stop)) + "Force use of tabs for indentation in all modes." + (setq indent-tabs-mode t) + (setq tab-width 4) + ;; Make TAB key insert a tab character instead of smart-indenting + (local-set-key (kbd "TAB") 'tab-to-tab-stop)) ;; Apply to all major modes (add-hook 'prog-mode-hook 'enforce-tabs) @@ -175,11 +188,11 @@ ;; Force conversion of spaces to tabs after indentation (defun tabify-current-line () - "Convert leading spaces to tabs on the current line." - (when indent-tabs-mode + "Convert leading spaces to tabs on the current line." + (when indent-tabs-mode (save-excursion - (beginning-of-line) - (when (looking-at "[ \t]+") + (beginning-of-line) + (when (looking-at "[ \t]+") (tabify (point) (match-end 0)))))) ;; Run after electric-indent @@ -196,39 +209,39 @@ :config ;; What to visualize (setq whitespace-style '(face - tabs - spaces - trailing - space-mark - tab-mark - newline - newline-mark)) + tabs + spaces + trailing + space-mark + tab-mark + newline + newline-mark)) ;; Character mappings (like Vim listchars) (setq whitespace-display-mappings '( - ;; tab: show as "│»»»" (char 9 = tab) - (tab-mark 9 [9474 187 187 187] [124 187 187 187]) - ;; space: show as "·" (char 32 = space) - (space-mark 32 [183] [46]) - ;; newline: show as "↲" (char 10 = newline) - (newline-mark 10 [8626 10] [182 10]) - ;; non-breaking space: show as "␣" - (space-mark 160 [9251] [95]))) + ;; tab: show as "│»»»" (char 9 = tab) + (tab-mark 9 [9474 187 187 187] [124 187 187 187]) + ;; space: show as "·" (char 32 = space) + (space-mark 32 [183] [46]) + ;; newline: show as "↲" (char 10 = newline) + (newline-mark 10 [8626 10] [182 10]) + ;; non-breaking space: show as "␣" + (space-mark 160 [9251] [95]))) ;; Face colors for whitespace characters - (set-face-attribute 'whitespace-tab nil - :foreground "#016868" - :background nil) - (set-face-attribute 'whitespace-space nil - :foreground "#016868" - :background nil) - (set-face-attribute 'whitespace-newline nil - :foreground "#016868" - :background nil) - (set-face-attribute 'whitespace-trailing nil - :foreground "#d2691e" - :background "#003030")) +(set-face-attribute 'whitespace-tab nil + :foreground "#016868" + :background nil) +(set-face-attribute 'whitespace-space nil + :foreground "#016868" + :background nil) +(set-face-attribute 'whitespace-newline nil + :foreground "#016868" + :background nil) +(set-face-attribute 'whitespace-trailing nil + :foreground "#d2691e" + :background "#003030")) ;; Toggle whitespace-mode with a keybinding ;; (global-set-key (kbd "C-c w") 'whitespace-mode) @@ -240,7 +253,7 @@ ;; Enable ligatures for JetBrains Mono ;; Uses composition-function-table for proper ligature rendering (defconst jetbrains-mono-ligatures - '("-->" "//" "/**" "/*" "*/" "" "//" "/**" "/*" "*/" "