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.

311 lines
9.0 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
  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 no-littering)
  34. (setq inhibit-startup-message t)
  35. (global-prettify-symbols-mode)
  36. (scroll-bar-mode -1)
  37. (menu-bar-mode -1)
  38. (tool-bar-mode -1)
  39. (tooltip-mode -1)
  40. (set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size)
  41. (set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size)
  42. (set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size)
  43. (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
  44. (use-package which-key
  45. :diminish which-key-mode
  46. :init (which-key-mode)
  47. :config (setq which-key-idle-delay dotfiles/idle))
  48. (use-package general
  49. :config
  50. (general-create-definer dotfiles/leader
  51. :states '(normal motion)
  52. :keymaps 'override
  53. :prefix dotfiles/leader-key))
  54. (use-package hydra)
  55. (use-package evil
  56. :init (setq evil-want-integration t
  57. evil-want-keybinding nil)
  58. :config (evil-mode 1))
  59. (use-package evil-collection
  60. :after evil
  61. :config (evil-collection-init))
  62. (use-package evil-nerd-commenter
  63. :bind ("M-;" . evilnc-comment-or-uncomment-lines))
  64. (defhydra hydra-text-scale (:timeout 4)
  65. "Scale"
  66. ("j" text-scale-increase "Increase")
  67. ("k" text-scale-decrease "Decrease")
  68. ("f" nil "Finished" :exit t))
  69. (dotfiles/leader
  70. "f" '(hydra-text-scale/body :which-key "Font"))
  71. (dotfiles/leader
  72. "," '(switch-to-buffer :which-key "Buffer")
  73. "." '(find-file :which-key "File"))
  74. (dotfiles/leader
  75. "q" '(:ignore t :which-key "Quit")
  76. "qq" '(save-buffers-kill-emacs :which-key "Save")
  77. "qw" '(kill-emacs :which-key "Now")
  78. "qf" '(delete-frame :which-key "Frame"))
  79. (dotfiles/leader
  80. "w" '(:ignore t :which-key "Window")
  81. "ww" '(window-swap-states :which-key "Swap")
  82. "wd" '(kill-buffer-and-window :which-key "Delete")
  83. "wc" '(delete-window :which-key "Close")
  84. "wh" '(windmove-left :which-key "Left")
  85. "wj" '(windmove-down :which-key "Down")
  86. "wk" '(windmove-up :which-key "Up")
  87. "wl" '(windmove-right :which-key "Right")
  88. "ws" '(:ignore t :which-key "Split")
  89. "wsj" '(split-window-below :which-key "Down")
  90. "wsl" '(split-window-right :which-key "Right"))
  91. (use-package linum-relative
  92. :init (setq linum-relative-backend
  93. 'display-line-numbers-mode)
  94. :config (linum-relative-global-mode))
  95. (use-package rainbow-delimiters
  96. :hook (prog-mode . rainbow-delimiters-mode))
  97. (use-package magit
  98. :custom (magit-display-buffer-function
  99. #'magit-display-buffer-same-window-except-diff-v1))
  100. (use-package forge)
  101. (dotfiles/leader
  102. "g" '(magit-status :which-key "Magit"))
  103. (use-package all-the-icons)
  104. (use-package all-the-icons-dired
  105. :hook (dired-mode . all-the-icons-dired-mode))
  106. (require 'dired-x)
  107. (dotfiles/leader
  108. "d" '(dired-jump :which-key "Dired"))
  109. (use-package eshell-prompt-extras
  110. :config (setq eshell-highlight-prompt nil
  111. eshell-prompt-function 'epe-theme-lambda))
  112. (dotfiles/leader
  113. "e" '(eshell :which-key "Shell"))
  114. (use-package doom-themes
  115. :init (load-theme 'doom-moonlight t))
  116. (dotfiles/leader
  117. "t" '(load-theme t nil :which-key "Theme"))
  118. (use-package doom-modeline
  119. :init (doom-modeline-mode 1)
  120. :custom ((doom-modeline-height 16)))
  121. (use-package password-store
  122. :custom (password-store-dir dotfiles/pass))
  123. (use-package lsp-mode
  124. :custom (gc-cons-threshold 1000000000)
  125. (lsp-idle-delay 0.500))
  126. (use-package lsp-ui
  127. :custom (lsp-ui-doc-position 'at-point)
  128. (lsp-ui-doc-delay 0.500))
  129. (use-package dap-mode)
  130. (use-package company)
  131. (use-package company-lsp)
  132. (use-package ccls
  133. :hook ((c-mode c++-mode objc-mode cuda-mode) .
  134. (lambda () (require 'ccls) (lsp))))
  135. (use-package python-mode
  136. :hook (python-mode . lsp)
  137. :config (require 'dap-python)
  138. :custom (python-shell-interpreter "python3") ;; Required if "python" is not python 3.
  139. (dap-python-executable "python3") ;; Same as above.
  140. (dap-python-debugger 'debugpy))
  141. (use-package rustic)
  142. (use-package go-mode
  143. :hook (go-mode . lsp))
  144. (use-package org
  145. :hook
  146. (org-mode . (lambda ()
  147. (org-indent-mode)
  148. (visual-line-mode 1)
  149. (variable-pitch-mode 1)))
  150. :config
  151. (setq org-ellipsis ""
  152. org-log-done 'time
  153. org-log-into-drawer t
  154. org-src-preserve-indentation t)
  155. (org-babel-do-load-languages
  156. 'org-babel-load-languages
  157. '((shell . t)
  158. (python . t)
  159. (emacs-lisp . t)))
  160. (require 'org-tempo)
  161. (add-to-list 'org-structure-template-alist '("s" . "src"))
  162. (add-to-list 'org-structure-template-alist '("q" . "quote"))
  163. (add-to-list 'org-structure-template-alist '("e" . "example"))
  164. (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
  165. (add-to-list 'org-structure-template-alist '("py" . "src python"))
  166. (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")))
  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. ;; (use-package mu4e
  196. ;; :ensure nil
  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. ;; ;; Ensure plain text scales for all devices.
  203. ;; (setq mu4e-compose-format-flowed t)
  204. ;; ;; GPG signing key for outbound mail.
  205. ;; (setq mml-secure-openpgp-signers '("37AB1CB72B741E478CA026D43025DCBD46F81C0F"))
  206. ;; (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
  207. ;; ;; Use SMTP to send messages.
  208. ;; (setq message-send-mail-function 'smtpmail-send-it)
  209. ;; ;; Configure mail account(s).
  210. ;; (setq mu4e-contexts
  211. ;; (list
  212. ;; ;; Main
  213. ;; ;; chris@chrishayward.xyz
  214. ;; (make-mu4e-context
  215. ;; :name "Main"
  216. ;; :match-func
  217. ;; (lambda (msg)
  218. ;; (when msg
  219. ;; (string-prefix-p "/Main" (mu4e-message-field msg :maildir))))
  220. ;; :vars
  221. ;; '((user-full-name . "Christopher James Hayward")
  222. ;; (user-mail-address . "chris@chrishayward.xyz")
  223. ;; (smtpmail-smtp-server . "mail.chrishayward.xyz")
  224. ;; (smtpmail-smtp-service . 587)
  225. ;; (smtpmail-stream-type . startls))))))
  226. (setq org-agenda-files '("~/.local/source/brain/daily/"
  227. "~/.local/source/secrets/org/"))
  228. (dotfiles/leader
  229. "a" '(org-agenda :which-key "Agenda"))
  230. (use-package ox-hugo
  231. :after ox)
  232. (add-to-list 'org-roam-capture-templates
  233. '("b" "Blogging" plain (function org-roam-capture--get-point)
  234. "%?"
  235. :file-name "posts/${slug}"
  236. :head "#+TITLE: ${title}\n#+HUGO_BASE_DIR: ../\n#+HUGO_SECTION: ./\n"))
  237. (use-package ox-reveal
  238. :after ox
  239. :custom (org-reveal-root "https://cdn.jsdelivr.net/reveal.js/3.9.2/"))
  240. (add-to-list 'org-roam-capture-templates
  241. '("p" "Presentation" plain (function org-roam-capture--get-point)
  242. "%?"
  243. :file-name "slides/${slug}"
  244. :head "#+TITLE: ${title}\n"))