I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

317 lines
9.1 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. (defun dotfiles/tangle (dir)
  2. "Recursively tangle the Org files within a directory."
  3. (let ((org-files (directory-files-recursively dir "org")))
  4. (dolist (f org-files)
  5. (org-babel-tangle-file f))))
  6. (defvar dotfiles/font "Fira Code")
  7. (defvar dotfiles/font-size 96)
  8. (defvar dotfiles/idle 0.0)
  9. (defvar dotfiles/leader-key "SPC")
  10. (defvar dotfiles/src "~/.local/source/")
  11. (defvar dotfiles/pass (concat dotfiles/src "passwords/"))
  12. (defvar dotfiles/brain (concat dotfiles/src "brain/"))
  13. (defvar dotfiles/home user-emacs-directory)
  14. (defvar dotfiles/cache "~/.cache/emacs")
  15. (setq create-lockfiles nil
  16. make-backup-files nil
  17. user-emacs-directory dotfiles/cache)
  18. (setq straight-repository-branch "develop"
  19. straight-use-package-by-default t)
  20. (defvar bootstrap-version)
  21. (let ((bootstrap-file
  22. (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
  23. (bootstrap-version 5))
  24. (unless (file-exists-p bootstrap-file)
  25. (with-current-buffer
  26. (url-retrieve-synchronously
  27. "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
  28. 'silent 'inhibit-cookies)
  29. (goto-char (point-max))
  30. (eval-print-last-sexp)))
  31. (load bootstrap-file nil 'nomessage))
  32. (straight-use-package 'use-package)
  33. (use-package org
  34. :hook
  35. (org-mode . (lambda ()
  36. (org-indent-mode)
  37. (visual-line-mode 1)
  38. (variable-pitch-mode 1)))
  39. :config
  40. (setq org-ellipsis ""
  41. org-log-done 'time
  42. org-log-into-drawer t
  43. org-src-preserve-indentation t)
  44. (org-babel-do-load-languages
  45. 'org-babel-load-languages
  46. '((shell . t)
  47. (python . t)
  48. (emacs-lisp . t)))
  49. (require 'org-tempo)
  50. (add-to-list 'org-structure-template-alist '("s" . "src"))
  51. (add-to-list 'org-structure-template-alist '("q" . "quote"))
  52. (add-to-list 'org-structure-template-alist '("e" . "example"))
  53. (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
  54. (add-to-list 'org-structure-template-alist '("py" . "src python"))
  55. (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")))
  56. (use-package no-littering)
  57. (setq inhibit-startup-message t)
  58. (global-prettify-symbols-mode)
  59. (scroll-bar-mode -1)
  60. (menu-bar-mode -1)
  61. (tool-bar-mode -1)
  62. (tooltip-mode -1)
  63. (set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size)
  64. (set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size)
  65. (set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size)
  66. (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
  67. (use-package which-key
  68. :diminish which-key-mode
  69. :init (which-key-mode)
  70. :config (setq which-key-idle-delay dotfiles/idle))
  71. (use-package general
  72. :config
  73. (general-create-definer dotfiles/leader
  74. :states '(normal motion)
  75. :keymaps 'override
  76. :prefix dotfiles/leader-key))
  77. (use-package hydra)
  78. (use-package evil
  79. :init (setq evil-want-integration t
  80. evil-want-keybinding nil)
  81. :config (evil-mode 1))
  82. (use-package evil-collection
  83. :after evil
  84. :config (evil-collection-init))
  85. (use-package evil-nerd-commenter
  86. :bind ("M-;" . evilnc-comment-or-uncomment-lines))
  87. (defhydra hydra-text-scale (:timeout 4)
  88. "Scale"
  89. ("j" text-scale-increase "Increase")
  90. ("k" text-scale-decrease "Decrease")
  91. ("f" nil "Finished" :exit t))
  92. (dotfiles/leader
  93. "f" '(hydra-text-scale/body :which-key "Font"))
  94. (dotfiles/leader
  95. "," '(switch-to-buffer :which-key "Buffer")
  96. "." '(find-file :which-key "File"))
  97. (dotfiles/leader
  98. "q" '(:ignore t :which-key "Quit")
  99. "qq" '(save-buffers-kill-emacs :which-key "Save")
  100. "qw" '(kill-emacs :which-key "Now")
  101. "qf" '(delete-frame :which-key "Frame"))
  102. (dotfiles/leader
  103. "w" '(:ignore t :which-key "Window")
  104. "ww" '(window-swap-states :which-key "Swap")
  105. "wd" '(kill-buffer-and-window :which-key "Delete")
  106. "wc" '(delete-window :which-key "Close")
  107. "wh" '(windmove-left :which-key "Left")
  108. "wj" '(windmove-down :which-key "Down")
  109. "wk" '(windmove-up :which-key "Up")
  110. "wl" '(windmove-right :which-key "Right")
  111. "ws" '(:ignore t :which-key "Split")
  112. "wsj" '(split-window-below :which-key "Down")
  113. "wsl" '(split-window-right :which-key "Right"))
  114. (use-package linum-relative
  115. :init (setq linum-relative-backend
  116. 'display-line-numbers-mode)
  117. :config (linum-relative-global-mode))
  118. (use-package rainbow-delimiters
  119. :hook (prog-mode . rainbow-delimiters-mode))
  120. (use-package magit
  121. :custom (magit-display-buffer-function
  122. #'magit-display-buffer-same-window-except-diff-v1))
  123. (use-package forge)
  124. (dotfiles/leader
  125. "g" '(magit-status :which-key "Magit"))
  126. (use-package all-the-icons)
  127. (use-package all-the-icons-dired
  128. :hook (dired-mode . all-the-icons-dired-mode))
  129. (require 'dired-x)
  130. (dotfiles/leader
  131. "d" '(dired-jump :which-key "Dired"))
  132. (use-package eshell-prompt-extras
  133. :config (setq eshell-highlight-prompt nil
  134. eshell-prompt-function 'epe-theme-lambda))
  135. (dotfiles/leader
  136. "e" '(eshell :which-key "Shell"))
  137. (use-package doom-themes
  138. :init (load-theme 'doom-moonlight t))
  139. (dotfiles/leader
  140. "t" '(load-theme t nil :which-key "Theme"))
  141. (use-package doom-modeline
  142. :init (doom-modeline-mode 1)
  143. :custom ((doom-modeline-height 16)))
  144. (use-package password-store
  145. :custom (password-store-dir dotfiles/pass))
  146. (use-package lsp-mode
  147. :custom (gc-cons-threshold 1000000000)
  148. (lsp-idle-delay 0.500))
  149. (use-package lsp-ui
  150. :custom (lsp-ui-doc-position 'at-point)
  151. (lsp-ui-doc-delay 0.500))
  152. (use-package dap-mode)
  153. (use-package company)
  154. (use-package company-lsp)
  155. (use-package ccls
  156. :hook ((c-mode c++-mode objc-mode cuda-mode) .
  157. (lambda () (require 'ccls) (lsp))))
  158. (use-package python-mode
  159. :hook (python-mode . lsp)
  160. :config (require 'dap-python)
  161. :custom (python-shell-interpreter "python3") ;; Required if "python" is not python 3.
  162. (dap-python-executable "python3") ;; Same as above.
  163. (dap-python-debugger 'debugpy))
  164. (use-package rustic)
  165. (use-package go-mode
  166. :hook (go-mode . lsp))
  167. (use-package org-superstar
  168. :hook (org-mode . org-superstar-mode))
  169. (use-package org-roam
  170. :hook (after-init . org-roam-mode)
  171. :custom (org-roam-directory dotfiles/brain))
  172. (use-package org-roam-server
  173. :hook (org-roam-mode . org-roam-server-mode))
  174. (dotfiles/leader
  175. "r" '(:ignore t :which-key "Roam")
  176. "rf" '(org-roam-find-file :which-key "Find")
  177. "rb" '(org-roam-buffer-toggle-display :which-key "Buffer")
  178. "rc" '(org-roam-capture :which-key "Capture")
  179. "rd" '(:ignore t :which-key "Dailies")
  180. "rdd" '(org-roam-dailies-find-date :which-key "Date")
  181. "rdt" '(org-roam-dailies-find-today :which-key "Today")
  182. "rdm" '(org-roam-dailies-find-tomorrow :which-key "Tomorrow")
  183. "rdy" '(org-roam-dailies-find-yesterday :which-key "Yesterday"))
  184. (setq org-roam-capture-templates
  185. '(("d" "Default" plain (function org-roam-capture--get-point)
  186. "%?"
  187. :file-name "${slug}"
  188. :head "#+TITLE: ${title}\n"
  189. :unnarrowed t)))
  190. (setq org-roam-dailies-capture-templates
  191. '(("d" "Default" entry (function org-roam-capture--get-point)
  192. "* %?"
  193. :file-name "daily/%<%Y-%m-%d>"
  194. :head "#+TITLE: %<%Y-%m-%d>\n")))
  195. (add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
  196. (use-package mu4e
  197. :config
  198. (setq mu4e-change-filenames-when-moving t
  199. mu4e-update-interval (* 5 60) ;; Every 5 minutes.
  200. mu4e-get-mail-command "mbsync -a"
  201. mu4e-maildir "~/.cache/mail"
  202. mu4e-compose-signature
  203. (concat "Chris Hayward\n"
  204. "https://chrishayward.xyz\n"))
  205. ;; Ensure plain text scales for all devices.
  206. (setq mu4e-compose-format-flowed t)
  207. ;; GPG signing key for outbound mail.
  208. (setq mml-secure-openpgp-signers '("37AB1CB72B741E478CA026D43025DCBD46F81C0F"))
  209. (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
  210. (setq message-send-mail-function 'smtpmail-send-it)
  211. ;; Configure mail account(s).
  212. (setq mu4e-contexts
  213. (list
  214. ;; Main
  215. ;; chris@chrishayward.xyz
  216. (make-mu4e-context
  217. :name "Main"
  218. :match-func
  219. (lambda (msg)
  220. (when msg
  221. (string-prefix-p "/Main" (mu4e-message-field msg :maildir))))
  222. :vars
  223. '((user-full-name . "Christopher James Hayward")
  224. (user-mail-address . "chris@chrishayward.xyz")
  225. (smtpmail-smtp-server . "mail.chrishayward.xyz")
  226. (smtpmail-smtp-service . 587)
  227. (smtpmail-stream-type . starttls))))))
  228. (dotfiles/leader
  229. "m" '(mu4e :which-key "Mail"))
  230. (setq org-agenda-files '("~/.local/source/brain/daily/"
  231. "~/.local/source/secrets/org/"))
  232. (dotfiles/leader
  233. "a" '(org-agenda :which-key "Agenda"))
  234. (use-package ox-hugo
  235. :after ox)
  236. (add-to-list 'org-roam-capture-templates
  237. '("b" "Blogging" plain (function org-roam-capture--get-point)
  238. "%?"
  239. :file-name "posts/${slug}"
  240. :head "#+TITLE: ${title}\n#+HUGO_BASE_DIR: ../\n#+HUGO_SECTION: ./\n"))
  241. (use-package ox-reveal
  242. :after ox
  243. :custom (org-reveal-root "https://cdn.jsdelivr.net/reveal.js/3.9.2/"))
  244. (add-to-list 'org-roam-capture-templates
  245. '("p" "Presentation" plain (function org-roam-capture--get-point)
  246. "%?"
  247. :file-name "slides/${slug}"
  248. :head "#+TITLE: ${title}\n"))