diff --git a/home/emacs/default.nix b/home/emacs/default.nix index 021f6a73..c5e4985c 100644 --- a/home/emacs/default.nix +++ b/home/emacs/default.nix @@ -1,6 +1,7 @@ { config, pkgs, ... }: { + stylix.targets.emacs.enable = false; xdg.configFile = { "emacs/init.el".source = ./init.el; "emacs/snippets".source = ./snippets; @@ -10,6 +11,12 @@ package = pkgs.emacs29-pgtk; extraPackages = epkgs: with epkgs; [ + # themes + modus-themes + doom-themes + base16-theme + tron-legacy-theme + # completion-packages cape consult diff --git a/home/emacs/init.el b/home/emacs/init.el index e0fe1fd7..7e064c93 100644 --- a/home/emacs/init.el +++ b/home/emacs/init.el @@ -56,7 +56,80 @@ (when (require 'auth-source nil :noerror) (setq auth-sources '("secrets:Login")) - (auth-source-pass-enable)) + (when (require 'auth-source-pass nil :noerror) + (auth-source-pass-enable))) + +;; Make `describe-*' screens more helpful +(use-package helpful + :ensure t + :bind ((" " . helpful-command) + (" " . helpful-callable) + (" " . helpful-key) + (" " . helpful-symbol) + (" " . helpful-variable) + ("C-h F" . helpful-function) + :map helpful-mode-map + (" " . helpful-update))) + +;; Bind extra `describe-*' commands +(keymap-global-set "C-h K" #'describe-keymap) + +(setq use-dialog-box nil + fill-column 80 + truncate-lines nil + truncate-partial-width-windows nil) + +(menu-bar-mode -1) +(tab-bar-mode -1) +(tool-bar-mode -1) +(scroll-bar-mode -1) +(line-number-mode) +(global-display-line-numbers-mode -1) +(global-prettify-symbols-mode +1) +(global-visual-line-mode +1) + +(use-package which-key + :ensure t + :config (which-key-mode +1)) + +(use-package page-break-lines + :ensure t + :config (global-page-break-lines-mode +1)) + +;; add visual pulse when changing focus, like beacon but built-in +;; from from https://karthinks.com/software/batteries-included-with-emacs/ +(defun pulse-line (&rest _) + "Pulse the current line." + (pulse-momentary-highlight-one-line (point))) + +(dolist (command '(scroll-up-command + scroll-down-command + recenter-top-bottom + other-window)) + (advice-add command :after #'pulse-line)) + +(set-frame-font "Fira Code-12") +(set-frame-parameter nil 'alpha-background 80) + +;; Theme +(use-package modus-themes + :ensure t + :config (load-theme 'modus-vivendi-tinted :noconfirm)) + +;; Nerd-Icons modes +(use-package nerd-icons + :ensure t + :config (nerd-icons-set-font "Symbols Nerd Font Mono")) + +(use-package nerd-icons-ibuffer + :ensure t + :hook dired-mode) + +(use-package nerd-icons-completion + :ensure t + :requires marginalia + :hook marginalia-mode + :config (nerd-icons-completion-mode +1)) (use-package ligature :ensure t @@ -129,6 +202,47 @@ ;; per mode with `ligature-mode'. (global-ligature-mode t)) +;; Doom-Modeline +(setq doom-modeline-icon t + doom-modeline-mu4e nil ;; Use mu4e own formatting + doom-modeline-modal nil + doom-modeline-modal-icon nil + doom-modeline-persp-name nil + doom-modeline-persp-icon nil) +(use-package doom-modeline + :ensure t + :config (doom-modeline-mode +1)) + +;; Dashboard +(setq dashboard-icon-type 'nerd-icons + dashboard-set-heading-icons t + dashboard-set-file-icons t + dashboard-set-navigator t + dashboard-set-init-info t + dashboard-startup-banner 'ascii + dashboard-projects-backend 'project-el + dashboard-projects-switch-function 'project-switch-project + dashboard-projects-show-base t + dashboard-recentf-show-base 'align + dashboard-items '() + dashboard-banner-ascii (concat " .000000. \n" + " .0. .0. \n" + " .00. .00. \n" + " .000cl. .lc000. \n" + ".0 0.\n" + "0. .o0000o. .0\n" + " 00 .0' '0. 00 \n" + " 00 .0 0. 00 \n" + " HHHHH HHHHHHHHHHHH HHHHH \n" + "HHHH HHH HHHHHHHHHHHHHH HHHH\n" + " HHHHHH HHHHHHHHH HHHHHHHH \n" + " HHH HHHH HHHHHHHHH HHHH \n" + " HHH HHHHHH \n" + " HHHHH HH \n")) +(use-package dashboard + :ensure t + :config (setq initial-buffer-choice 'dashboard-open)) + (setq org-directory "~/Org" org-default-notes-file (expand-file-name "notes.org" org-directory) org-pretty-entities-include-sub-superscripts t @@ -202,116 +316,6 @@ (add-hook 'org-agenda-mode-hook #'khalel-import-events) (khalel-add-capture-template "e")) -(setq use-dialog-box nil - fill-column 80 - truncate-lines nil - truncate-partial-width-windows nil) - -(menu-bar-mode -1) -(tab-bar-mode -1) -(tool-bar-mode -1) -(scroll-bar-mode -1) -(line-number-mode) -(global-display-line-numbers-mode -1) -(global-prettify-symbols-mode +1) -(global-visual-line-mode +1) -;; (set-frame-font "FiraCode Nerd Font-12") -;; (set-frame-parameter nil 'alpha-background 80) - -;; Nerd-Icons modes -(when (require 'nerd-icons nil :noerror) - (nerd-icons-set-font "Symbols Nerd Font Mono") - (when (require 'nerd-icons-dired nil :noerror) - (add-hook 'dired-mode-hook #'nerd-icons-dired-mode)) - - (when (require 'nerd-icons-ibuffer nil :noerror) - (add-hook 'ibuffer-mode-hook #'nerd-icons-ibuffer-mode)) - - (when (require 'nerd-icons-completion nil :noerror) - (nerd-icons-completion-mode) - (when (require 'marginalia nil :noerror) - (add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup)))) - -;; Doom-Modeline -(setq doom-modeline-icon t - doom-modeline-mu4e nil ;; Use mu4e own formatting - doom-modeline-modal nil - doom-modeline-modal-icon nil - doom-modeline-persp-name nil - doom-modeline-persp-icon nil) -(when (require 'doom-modeline nil :noerror) - (doom-modeline-mode +1)) - -;; Dashboard -(setq initial-buffer-choice 'dashboard-open - dashboard-icon-type 'nerd-icons - dashboard-set-heading-icons t - dashboard-set-file-icons t - dashboard-set-navigator t - dashboard-set-init-info t - dashboard-startup-banner 'ascii - dashboard-projects-backend 'project-el - dashboard-projects-switch-function 'project-switch-project - dashboard-projects-show-base t - dashboard-recentf-show-base 'align - dashboard-items '() - dashboard-banner-ascii (concat " .000000. \n" - " .0. .0. \n" - " .00. .00. \n" - " .000cl. .lc000. \n" - ".0 0.\n" - "0. .o0000o. .0\n" - " 00 .0' '0. 00 \n" - " 00 .0 0. 00 \n" - " HHHHH HHHHHHHHHHHH HHHHH \n" - "HHHH HHH HHHHHHHHHHHHHH HHHH\n" - " HHHHHH HHHHHHHHH HHHHHHHH \n" - " HHH HHHH HHHHHHHHH HHHH \n" - " HHH HHHHHH \n" - " HHHHH HH \n")) -(when (require 'dashboard nil :noerror) - (keymap-global-set "C-c d" #'dashboard-open)) - -;; Extra minor-modes -(when (require 'git-gutter nil :noerror) - (global-git-gutter-mode +1)) - -(when (require 'which-key nil :noerror) - (which-key-mode +1)) - -(when (require 'page-break-lines nil :noerror) - (global-page-break-lines-mode +1)) - -;;;; Help Buffers - -;; Make `describe-*' screens more helpful -(when (require 'helpful nil :noerror) - (keymap-set helpful-mode-map " " #'helpful-update) - (keymap-global-set " " #'helpful-command) - (keymap-global-set " " #'helpful-callable) - (keymap-global-set " " #'helpful-key) - (keymap-global-set " " #'helpful-symbol) - (keymap-global-set " " #'helpful-variable) - (keymap-global-set "C-h F" #'helpful-function)) - -;; Bind extra `describe-*' commands -(keymap-global-set "C-h K" #'describe-keymap) - -;; add visual pulse when changing focus, like beacon but built-in -;; from from https://karthinks.com/software/batteries-included-with-emacs/ -(defun pulse-line (&rest _) - "Pulse the current line." - (pulse-momentary-highlight-one-line (point))) - -(dolist (command '(scroll-up-command - scroll-down-command - recenter-top-bottom - other-window)) - (advice-add command :after #'pulse-line)) - - -;;; custom-ui-config.el ends here - (setq sendmail-program (executable-find "msmtp") send-mail-function #'smtpmail-send-it message-sendmail-f-is-evil t @@ -350,7 +354,7 @@ (:subject)) mu4e-headers-actions '(("org capture message" . mu4e-org-store-and-capture) ("capture message" . mu4e-action-capture-message) - ("show this thread" . mu4e-action-show-thread)) + ("show this thread" . mu4e-action-show-thread)) mu4e-maildir-shortcuts '((:maildir "/Proton/Inbox/" :key ?p) (:maildir "/iCloud/Inbox/" :key ?i) (:maildir "/Outlook/Inbox/" :key ?w))) @@ -408,7 +412,7 @@ (add-hook 'elfeed-search-mode-hook #'elfeed-update) (when (require 'elfeed-org nil :noerror) (elfeed-org)) - (when (require 'elfeed-tube nil :noerror) + (when (require 'elfeed-tube nil :noerror) (elfeed-tube-setup))) (when (require 'rainbow-delimiters nil :noerror) diff --git a/home/emacs/init.org b/home/emacs/init.org index 2a1e2e4b..219de7eb 100644 --- a/home/emacs/init.org +++ b/home/emacs/init.org @@ -5,7 +5,6 @@ #+PROPERTY: header-args:emacs-lisp :tangle yes :mkdirp yes :results output silent * Common defaults - #+BEGIN_SRC emacs-lisp :results output silent (setq custom-file (locate-user-emacs-file "custom.el")) (when (and custom-file (file-exists-p custom-file)) @@ -71,9 +70,92 @@ #+begin_src emacs-lisp (when (require 'auth-source nil :noerror) (setq auth-sources '("secrets:Login")) - (auth-source-pass-enable)) + (when (require 'auth-source-pass nil :noerror) + (auth-source-pass-enable))) #+end_src + +** Helpful +#+begin_src emacs-lisp + ;; Make `describe-*' screens more helpful + (use-package helpful + :ensure t + :bind ((" " . helpful-command) + (" " . helpful-callable) + (" " . helpful-key) + (" " . helpful-symbol) + (" " . helpful-variable) + ("C-h F" . helpful-function) + :map helpful-mode-map + (" " . helpful-update))) + + ;; Bind extra `describe-*' commands + (keymap-global-set "C-h K" #'describe-keymap) +#+end_src + * UI +#+begin_src emacs-lisp + (setq use-dialog-box nil + fill-column 80 + truncate-lines nil + truncate-partial-width-windows nil) + + (menu-bar-mode -1) + (tab-bar-mode -1) + (tool-bar-mode -1) + (scroll-bar-mode -1) + (line-number-mode) + (global-display-line-numbers-mode -1) + (global-prettify-symbols-mode +1) + (global-visual-line-mode +1) + + (use-package which-key + :ensure t + :config (which-key-mode +1)) + + (use-package page-break-lines + :ensure t + :config (global-page-break-lines-mode +1)) + + ;; add visual pulse when changing focus, like beacon but built-in + ;; from from https://karthinks.com/software/batteries-included-with-emacs/ + (defun pulse-line (&rest _) + "Pulse the current line." + (pulse-momentary-highlight-one-line (point))) + + (dolist (command '(scroll-up-command + scroll-down-command + recenter-top-bottom + other-window)) + (advice-add command :after #'pulse-line)) +#+end_src + +** Theme, font and nerd-icons +#+begin_src emacs-lisp + (set-frame-font "Fira Code-12") + (set-frame-parameter nil 'alpha-background 80) + + ;; Theme + (use-package modus-themes + :ensure t + :config (load-theme 'modus-vivendi-tinted :noconfirm)) + + ;; Nerd-Icons modes + (use-package nerd-icons + :ensure t + :config (nerd-icons-set-font "Symbols Nerd Font Mono")) + + (use-package nerd-icons-dired + :ensure t + :hook (dired-mode)) + + (use-package nerd-icons-ibuffer + :ensure t + :hook (ibuffer-mode)) + + (use-package nerd-icons-completion + :ensure t + :config (nerd-icons-completion-mode +1)) +#+end_src ** Font ligatures #+begin_src emacs-lisp @@ -148,6 +230,53 @@ ;; per mode with `ligature-mode'. (global-ligature-mode t)) #+end_src + +** Modeline +#+begin_src emacs-lisp + ;; Doom-Modeline + (setq doom-modeline-icon t + doom-modeline-mu4e nil ;; Use mu4e own formatting + doom-modeline-modal nil + doom-modeline-modal-icon nil + doom-modeline-persp-name nil + doom-modeline-persp-icon nil) + (use-package doom-modeline + :ensure t + :config (doom-modeline-mode +1)) +#+end_src + +** Dashboard +#+begin_src emacs-lisp + ;; Dashboard + (setq dashboard-icon-type 'nerd-icons + dashboard-set-heading-icons t + dashboard-set-file-icons t + dashboard-set-navigator t + dashboard-set-init-info t + dashboard-startup-banner 'ascii + dashboard-projects-backend 'project-el + dashboard-projects-switch-function 'project-switch-project + dashboard-projects-show-base t + dashboard-recentf-show-base 'align + dashboard-items '() + dashboard-banner-ascii (concat " .000000. \n" + " .0. .0. \n" + " .00. .00. \n" + " .000cl. .lc000. \n" + ".0 0.\n" + "0. .o0000o. .0\n" + " 00 .0' '0. 00 \n" + " 00 .0 0. 00 \n" + " HHHHH HHHHHHHHHHHH HHHHH \n" + "HHHH HHH HHHHHHHHHHHHHH HHHH\n" + " HHHHHH HHHHHHHHH HHHHHHHH \n" + " HHH HHHH HHHHHHHHH HHHH \n" + " HHH HHHHHH \n" + " HHHHH HH \n")) + (use-package dashboard + :ensure t + :config (setq initial-buffer-choice 'dashboard-open)) +#+end_src * Org-mode For reference information, see [[https://orgmode.com][Org-mode website]] @@ -247,120 +376,6 @@ For reference information, see [[https://orgmode.com][Org-mode website]] For now I'll just copy all config into this file, to confirm that it works properly. Will reorganise into separate sections later -** TODO UI -#+BEGIN_SRC emacs-lisp - (setq use-dialog-box nil - fill-column 80 - truncate-lines nil - truncate-partial-width-windows nil) - - (menu-bar-mode -1) - (tab-bar-mode -1) - (tool-bar-mode -1) - (scroll-bar-mode -1) - (line-number-mode) - (global-display-line-numbers-mode -1) - (global-prettify-symbols-mode +1) - (global-visual-line-mode +1) - ;; (set-frame-font "FiraCode Nerd Font-12") - ;; (set-frame-parameter nil 'alpha-background 80) - - ;; Nerd-Icons modes - (when (require 'nerd-icons nil :noerror) - (nerd-icons-set-font "Symbols Nerd Font Mono") - (when (require 'nerd-icons-dired nil :noerror) - (add-hook 'dired-mode-hook #'nerd-icons-dired-mode)) - - (when (require 'nerd-icons-ibuffer nil :noerror) - (add-hook 'ibuffer-mode-hook #'nerd-icons-ibuffer-mode)) - - (when (require 'nerd-icons-completion nil :noerror) - (nerd-icons-completion-mode) - (when (require 'marginalia nil :noerror) - (add-hook 'marginalia-mode-hook #'nerd-icons-completion-marginalia-setup)))) - - ;; Doom-Modeline - (setq doom-modeline-icon t - doom-modeline-mu4e nil ;; Use mu4e own formatting - doom-modeline-modal nil - doom-modeline-modal-icon nil - doom-modeline-persp-name nil - doom-modeline-persp-icon nil) - (when (require 'doom-modeline nil :noerror) - (doom-modeline-mode +1)) - - ;; Dashboard - (setq initial-buffer-choice 'dashboard-open - dashboard-icon-type 'nerd-icons - dashboard-set-heading-icons t - dashboard-set-file-icons t - dashboard-set-navigator t - dashboard-set-init-info t - dashboard-startup-banner 'ascii - dashboard-projects-backend 'project-el - dashboard-projects-switch-function 'project-switch-project - dashboard-projects-show-base t - dashboard-recentf-show-base 'align - dashboard-items '() - dashboard-banner-ascii (concat " .000000. \n" - " .0. .0. \n" - " .00. .00. \n" - " .000cl. .lc000. \n" - ".0 0.\n" - "0. .o0000o. .0\n" - " 00 .0' '0. 00 \n" - " 00 .0 0. 00 \n" - " HHHHH HHHHHHHHHHHH HHHHH \n" - "HHHH HHH HHHHHHHHHHHHHH HHHH\n" - " HHHHHH HHHHHHHHH HHHHHHHH \n" - " HHH HHHH HHHHHHHHH HHHH \n" - " HHH HHHHHH \n" - " HHHHH HH \n")) - (when (require 'dashboard nil :noerror) - (keymap-global-set "C-c d" #'dashboard-open)) - - ;; Extra minor-modes - (when (require 'git-gutter nil :noerror) - (global-git-gutter-mode +1)) - - (when (require 'which-key nil :noerror) - (which-key-mode +1)) - - (when (require 'page-break-lines nil :noerror) - (global-page-break-lines-mode +1)) - - ;;;; Help Buffers - - ;; Make `describe-*' screens more helpful - (when (require 'helpful nil :noerror) - (keymap-set helpful-mode-map " " #'helpful-update) - (keymap-global-set " " #'helpful-command) - (keymap-global-set " " #'helpful-callable) - (keymap-global-set " " #'helpful-key) - (keymap-global-set " " #'helpful-symbol) - (keymap-global-set " " #'helpful-variable) - (keymap-global-set "C-h F" #'helpful-function)) - - ;; Bind extra `describe-*' commands - (keymap-global-set "C-h K" #'describe-keymap) - - ;; add visual pulse when changing focus, like beacon but built-in - ;; from from https://karthinks.com/software/batteries-included-with-emacs/ - (defun pulse-line (&rest _) - "Pulse the current line." - (pulse-momentary-highlight-one-line (point))) - - (dolist (command '(scroll-up-command - scroll-down-command - recenter-top-bottom - other-window)) - (advice-add command :after #'pulse-line)) - - - ;;; custom-ui-config.el ends here - -#+END_SRC - ** TODO Email #+BEGIN_SRC emacs-lisp (setq sendmail-program (executable-find "msmtp") @@ -401,7 +416,7 @@ Will reorganise into separate sections later (:subject)) mu4e-headers-actions '(("org capture message" . mu4e-org-store-and-capture) ("capture message" . mu4e-action-capture-message) - ("show this thread" . mu4e-action-show-thread)) + ("show this thread" . mu4e-action-show-thread)) mu4e-maildir-shortcuts '((:maildir "/Proton/Inbox/" :key ?p) (:maildir "/iCloud/Inbox/" :key ?i) (:maildir "/Outlook/Inbox/" :key ?w))) @@ -463,7 +478,7 @@ Will reorganise into separate sections later (add-hook 'elfeed-search-mode-hook #'elfeed-update) (when (require 'elfeed-org nil :noerror) (elfeed-org)) - (when (require 'elfeed-tube nil :noerror) + (when (require 'elfeed-tube nil :noerror) (elfeed-tube-setup))) #+END_SRC