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.

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