diff --git a/home/emacs/modules/custom-defaults-config.el b/home/emacs/modules/custom-defaults-config.el index 1c6650a3..71406a6c 100644 --- a/home/emacs/modules/custom-defaults-config.el +++ b/home/emacs/modules/custom-defaults-config.el @@ -20,11 +20,13 @@ (global-auto-revert-mode +1) (delete-selection-mode) -;; define a key to define the word at point. +;; Misc useful keymaps (keymap-set global-map "M-#" #'dictionary-lookup-definition) - -;; define key to open recent files (keymap-set global-map "C-c r" #'recentf) +(keymap-set global-map "C-c b" #'ibuffer) +(keymap-set global-map "C-c p p" list-packages) +(keymap-set global-map "C-c p i" package-install) +(keymap-set global-map "C-c p d" package-delete) ;; turn on spell checking, if available. (with-eval-after-load 'ispell @@ -32,17 +34,6 @@ (add-hook 'text-mode-hook #'flyspell-mode) (add-hook 'prog-mode-hook #'flyspell-prog-mode))) -;; window movement hydra (TODO) -(when (require 'hydra nil :noerror) - (defhydra window (global-map "C-c w") - "Window movement" - ("u" winner-undo) - ("r" winner-redo) - ("n" windmove-down) - ("p" windmove-up) - ("b" windmove-left) - ("f" windmove-right))) - ;; Make shebang (#!) file executable when saved (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) diff --git a/home/emacs/modules/custom-email-config.el b/home/emacs/modules/custom-email-config.el index e795f501..ae3fbde5 100644 --- a/home/emacs/modules/custom-email-config.el +++ b/home/emacs/modules/custom-email-config.el @@ -1,53 +1,49 @@ -(setq mail-user-agent 'notmuch-user-agent - sendmail-program (executable-find "msmtp") +(setq sendmail-program (executable-find "msmtp") send-mail-function #'smtpmail-send-it message-sendmail-f-is-evil t message-sendmail-extra-arguments '("--read-envelope-from") message-send-mail-function #'message-send-mail-with-sendmail - message-kill-buffer-on-exit t - notmuch-search-oldest-first nil - notmuch-show-logo nil - notmuch-hello-thousands-separator "," - notmuch-archive-tags '("+archive" "-inbox") - notmuch-message-headers-visible nil - notmuch-multipart/alternative-discouraged '("text/plain" "multipart/related") - notmuch-show-all-multipart/alternative-parts nil - notmuch-hello-sections '(notmuch-hello-insert-header - notmuch-hello-insert-saved-searches - notmuch-hello-insert-inbox - notmuch-hello-insert-alltags) - notmuch-fcc-dirs '((".*@xenia.me.uk" . "Proton/Sent") - (".*@proton.me" . "Proton/Sent") - (".*@litherlandsmith.slmail.me" . "Proton/Sent") - (".*@icloud.com" . "iCloud/Sent") - (".*@ukaea.uk" . "Outlook/Sent") - (".*@jet.uk" . "Outlook/Sent")) - notmuch-saved-searches '((:name "inbox" :query "tag:inbox" :key "i") - (:name "unread" :query "tag:unread AND tag:inbox" :key "u") - (:name "flagged" :query "tag:flagged" :key "f") - (:name "sent" :query "tag:sent" :key "t") - (:name "drafts" :query "tag:draft" :key "d") - (:name "all mail" :query "*" :key "a")) - notmuch-tagging-keys '(("a" notmuch-archive-tags "Archive") - ("u" notmuch-show-mark-read-tags "Mark read") - ("f" ("+flagged") "Flag") - ("s" ("+spam" "-inbox") "Mark as spam") - ("d" ("+deleted" "-inbox" "-unread") "Delete")) - notmuch-indicator-args '((:terms "tag:unread AND tag:inbox" :label "󰮒 ")) - notmuch-indicator-force-refresh-commands '(notmuch-refresh-this-buffer - notmuch-refresh-all-buffers - notmuch-poll-and-refresh-this-buffer)) + message-kill-buffer-on-exit t) (when (require 'notmuch nil :noerror) - (require 'notmuch-indicator) - (notmuch-indicator-mode +1) - (when (require 'hydra nil :noerror) - (defhydra email (global-map "C-c m") - "email" - ("m" notmuch) - ("c" notmuch-mua-new-mail) - ("s" notmuch-search) - ("i" (notmuch-search "is:inbox")) - ("u" (notmuch-search "is:unread AND is:inbox"))))) + (keymap-set global-map "C-c m m" #'notmuch) + (keymap-set global-map "C-c m c" #'notmuch-mua-new-mail) + (keymap-set global-map "C-c m s" #'notmuch-search) + (setq mail-user-agent 'notmuch-user-agent + notmuch-search-oldest-first nil + notmuch-show-logo nil + notmuch-hello-thousands-separator "," + notmuch-archive-tags '("+archive" "-inbox") + notmuch-message-headers-visible nil + notmuch-multipart/alternative-discouraged '("text/plain" "multipart/related") + notmuch-show-all-multipart/alternative-parts nil + notmuch-hello-sections '(notmuch-hello-insert-header + notmuch-hello-insert-saved-searches + notmuch-hello-insert-inbox + notmuch-hello-insert-alltags) + notmuch-fcc-dirs '((".*@xenia.me.uk" . "Proton/Sent") + (".*@proton.me" . "Proton/Sent") + (".*@litherlandsmith.slmail.me" . "Proton/Sent") + (".*@icloud.com" . "iCloud/Sent") + (".*@ukaea.uk" . "Outlook/Sent") + (".*@jet.uk" . "Outlook/Sent")) + notmuch-saved-searches '((:name "inbox" :query "tag:inbox" :key "i") + (:name "unread" :query "tag:unread AND tag:inbox" :key "u") + (:name "flagged" :query "tag:flagged" :key "f") + (:name "sent" :query "tag:sent" :key "t") + (:name "drafts" :query "tag:draft" :key "d") + (:name "all mail" :query "*" :key "a")) + notmuch-tagging-keys '(("a" notmuch-archive-tags "Archive") + ("u" notmuch-show-mark-read-tags "Mark read") + ("f" ("+flagged") "Flag") + ("s" ("+spam" "-inbox") "Mark as spam") + ("d" ("+deleted" "-inbox" "-unread") "Delete"))) + + (when (require 'notmuch-indicator nil :noerror) + (setq notmuch-indicator-args '((:terms "tag:unread AND tag:inbox" :label "󰮒 ")) + notmuch-indicator-force-refresh-commands '(notmuch-refresh-this-buffer + notmuch-refresh-all-buffers + notmuch-poll-and-refresh-this-buffer)) + (notmuch-indicator-mode +1))) (provide 'custom-email-config) diff --git a/home/emacs/modules/custom-feed-config.el b/home/emacs/modules/custom-feed-config.el index 646794c9..6fa4c348 100644 --- a/home/emacs/modules/custom-feed-config.el +++ b/home/emacs/modules/custom-feed-config.el @@ -1,9 +1,8 @@ -(let ((elfeed-base-directory "~/.elfeed")) - (setq elfeed-db-directory (expand-file-name "db" elfeed-base-directory) - elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory) - rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory)))) - (when (require 'elfeed nil :noerror) + (let ((elfeed-base-directory "~/.elfeed")) + (setq elfeed-db-directory (expand-file-name "db" elfeed-base-directory) + elfeed-enclosure-default-dir (expand-file-name "enclosures" elfeed-base-directory) + rmh-elfeed-org-files (list (expand-file-name "feeds.org" elfeed-base-directory)))) (add-hook 'elfeed-search-mode-hook #'elfeed-update) (when (require 'elfeed-org nil :noerror) (elfeed-org)) (when (require 'elfeed-tube nil :noerror) (elfeed-tube-setup))) diff --git a/home/emacs/modules/custom-ide-config.el b/home/emacs/modules/custom-ide-config.el index ca7d8d98..b829b63f 100644 --- a/home/emacs/modules/custom-ide-config.el +++ b/home/emacs/modules/custom-ide-config.el @@ -1,17 +1,23 @@ -(setq direnv-always-show-summary nil - apheleia-remote-algorithm 'local) +(when (require 'aggressive-indent nil :noerror) + (add-hook 'prog-mode-hook #'aggressive-indent-mode)) -(when (require 'aggressive-indent nil :noerror) (add-hook 'prog-mode-hook #'aggressive-indent-mode)) +(when (require 'rainbow-delimiters nil :noerror) + (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)) -(when (require 'rainbow-delimiters nil :noerror) (add-hook 'prog-mode-hook #'rainbow-delimiters-mode)) +(when (require 'treesit-aut nil :noerror) + (global-treesit-auto-mode +1)) -(when (require 'treesit-aut nil :noerror) (global-treesit-auto-mode +1)) +(when (require 'apheleia nil :noerror) + (setq apheleia-remote-algorithm 'local) + (keymap-set global-map "C-c c f" #'apheleia-format-buffer) + (apheleia-global-mode +1)) -(when (require 'apheleia nil :noerror) (apheleia-global-mode +1)) +(when (require 'eglot nil :noerror) + (eglot-ensure)) -(when (require 'eglot nil :noerror) (eglot-ensure)) - -(when (require 'direnv nil :noerror) (direnv-mode +1)) +(when (require 'direnv nil :noerror) + (setq direnv-always-show-summary nil) + (direnv-mode +1)) (when (require 'yasnippet nil :noerror) (require 'yasnippet-snippets nil :noerror) diff --git a/home/emacs/modules/custom-media-config.el b/home/emacs/modules/custom-media-config.el index 09d77c31..c42b8eb8 100644 --- a/home/emacs/modules/custom-media-config.el +++ b/home/emacs/modules/custom-media-config.el @@ -1,12 +1,13 @@ -(setq emms-player-list '(emms-player-mpv) - emms-info-functions '(emms-info-native) - emms-source-file-default-directory "~/Music" - emms-lyrics-dir "~/Music/lyrics") - (when (require 'emms-setup nil :noerror) + (setq emms-player-list '(emms-player-mpv) + emms-info-functions '(emms-info-native) + emms-source-file-default-directory "~/Music" + emms-lyrics-dir "~/Music/lyrics") + (emms-all) (add-hook 'emms-player-started-hook #'emms-show) (add-hook 'emms-player-paused-hook #'emms-show) + (when (require 'hydra nil :noerror) (defhydra emms (global-map "C-c e") "emms" diff --git a/home/emacs/modules/custom-org-config.el b/home/emacs/modules/custom-org-config.el index b5704796..2e4d1bab 100644 --- a/home/emacs/modules/custom-org-config.el +++ b/home/emacs/modules/custom-org-config.el @@ -16,6 +16,13 @@ org-outline-path-complete-in-steps nil org-default-notes-file (expand-file-name "notes.org" org-directory)) +(keymap-set global-map "C-c o a" org-agenda) +(keymap-set global-map "C-c o n" org-capture) +(keymap-set global-map "C-c o c" org-goto-calendar) +(keymap-set global-map "C-c o j j" org-journal-new-entry) +(keymap-set global-map "C-c o j n" org-journal-new-date-entry) +(keymap-set global-map "C-c o j s" org-journal-new-scheduled-entry) + (setq org-capture-templates '(("n" "Note" entry (file+headline "notes.org" "Inbox") @@ -39,14 +46,4 @@ :emptry-lines 1) )) -(when (require 'hydra nil :noerror) - (defhydra org (global-map "C-c o") - "Org-Mode" - ("a" org-agenda) - ("n" org-capture) - ("c" org-goto-calendar) - ("j j" org-journal-new-entry) - ("j n" org-journal-new-date-entry) - ("j s" org-journal-new-scheduled-entry))) - (provide 'custom-org-config) diff --git a/home/emacs/modules/custom-project-config.el b/home/emacs/modules/custom-project-config.el index de33d827..f6bb0c51 100644 --- a/home/emacs/modules/custom-project-config.el +++ b/home/emacs/modules/custom-project-config.el @@ -4,7 +4,9 @@ (project-find-file "Find file") (project-find-regexp "Find regexp") (project-find-dir "Find directory") - (project-eshell "Eshell")) - magit-clone-default-directory "~/Projects/") + (project-eshell "Eshell"))) + +(when (require 'magit nil :noerror) + (setq magit-clone-default-directory "~/Projects/")) (provide 'custom-project-config) diff --git a/home/emacs/modules/custom-ui-config.el b/home/emacs/modules/custom-ui-config.el index 1078a30f..f5eda44f 100644 --- a/home/emacs/modules/custom-ui-config.el +++ b/home/emacs/modules/custom-ui-config.el @@ -9,33 +9,7 @@ (setq use-dialog-box nil display-line-numbers 'relative - fill-column 80 - 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 '((projects . 5) (agenda . 5) (recents . 5)) - 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")) + fill-column 80) (defun my/set-frame-alpha () (set-frame-parameter nil 'alpha-background 80)) @@ -46,14 +20,63 @@ (global-word-wrap-whitespace-mode +1) (set-frame-parameter nil 'alpha-background 80) (add-hook 'server-after-make-frame-hook (lambda () (set-frame-parameter nil 'alpha-background 80))) -(when (require 'doom-themes nil :noerror) (load-theme 'doom-tokyo-night t)) + +(when (require 'doom-themes nil :noerror) + (load-theme 'doom-tokyo-night t)) + +;; Nerd-Icons modes +(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 +(when (require 'doom-modeline nil :noerror) + (setq doom-modeline-icon t) + (display-battery-mode) + (doom-modeline-mode +1)) ;; Dashboard -(when (require 'dashboard nil :noerror) (setq initial-buffer-choice 'dashboard-open)) +(when (require 'dashboard nil :noerror) + (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 '((projects . 5) (agenda . 5) (recents . 5)) + 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"))) ;; Extra minor-modes -(when (require 'which-key nil :noerror) (which-key-mode +1)) -(when (require 'page-break nil :noerror) (global-page-break-lines-mode +1)) +(when (require 'which-key nil :noerror) + (which-key-mode +1)) + +(when (require 'page-break nil :noerror) + (global-page-break-lines-mode +1)) ;;;; Help Buffers diff --git a/system/emacs.nix b/system/emacs.nix index 7ef35de0..9e7a4c28 100644 --- a/system/emacs.nix +++ b/system/emacs.nix @@ -60,8 +60,12 @@ # ui-packages all-the-icons nerd-icons + nerd-icons-completion + nerd-icons-dired + nerd-icons-ibuffer page-break-lines dashboard + doom-modeline helpful which-key link-hint