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.

267 lines
7.6 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
  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. (dotfiles/leader
  79. "w" '(:ignore t :which-key "Window")
  80. "ww" '(window-swap-states :which-key "Swap")
  81. "wd" '(kill-buffer-and-window :which-key "Delete")
  82. "wc" '(delete-window :which-key "Close")
  83. "wh" '(windmove-left :which-key "Left")
  84. "wj" '(windmove-down :which-key "Down")
  85. "wk" '(windmove-up :which-key "Up")
  86. "wl" '(windmove-right :which-key "Right")
  87. "ws" '(:ignore t :which-key "Split")
  88. "wsj" '(split-window-below :which-key "Down")
  89. "wsl" '(split-window-right :which-key "Right"))
  90. (use-package linum-relative
  91. :init (setq linum-relative-backend
  92. 'display-line-numbers-mode)
  93. :config (linum-relative-global-mode))
  94. (use-package rainbow-delimiters
  95. :hook (prog-mode . rainbow-delimiters-mode))
  96. (use-package magit
  97. :custom (magit-display-buffer-function
  98. #'magit-display-buffer-same-window-except-diff-v1))
  99. (use-package forge)
  100. (dotfiles/leader
  101. "g" '(magit-status :which-key "Magit"))
  102. (use-package all-the-icons)
  103. (use-package all-the-icons-dired
  104. :hook (dired-mode . all-the-icons-dired-mode))
  105. (require 'dired-x)
  106. (dotfiles/leader
  107. "d" '(dired-jump :which-key "Dired"))
  108. (use-package eshell-prompt-extras
  109. :config (setq eshell-highlight-prompt nil
  110. eshell-prompt-function 'epe-theme-lambda))
  111. (dotfiles/leader
  112. "e" '(eshell :which-key "Shell"))
  113. (use-package doom-themes
  114. :init (load-theme 'doom-moonlight t))
  115. (dotfiles/leader
  116. "t" '(load-theme t nil :which-key "Theme"))
  117. (use-package doom-modeline
  118. :init (doom-modeline-mode 1)
  119. :custom ((doom-modeline-height 16)))
  120. (use-package password-store
  121. :custom (password-store-dir dotfiles/pass))
  122. (use-package lsp-mode
  123. :custom (gc-cons-threshold 1000000000)
  124. (lsp-idle-delay 0.500))
  125. (use-package lsp-ui
  126. :custom (lsp-ui-doc-position 'at-point)
  127. (lsp-ui-doc-delay 0.500))
  128. (use-package dap-mode)
  129. (use-package company)
  130. (use-package company-lsp)
  131. (use-package python-mode
  132. :hook (python-mode . lsp)
  133. :config (require 'dap-python)
  134. :custom (python-shell-interpreter "python3") ;; Required if "python" is not python 3.
  135. (dap-python-executable "python3") ;; Same as above.
  136. (dap-python-debugger 'debugpy))
  137. (use-package rustic)
  138. (use-package org
  139. :hook
  140. (org-mode . (lambda ()
  141. (org-indent-mode)
  142. (visual-line-mode 1)
  143. (variable-pitch-mode 1)))
  144. :config
  145. (setq org-ellipsis ""
  146. org-log-done 'time
  147. org-log-into-drawer t
  148. org-src-preserve-indentation t)
  149. (org-babel-do-load-languages
  150. 'org-babel-load-languages
  151. '((shell . t)
  152. (python . t)
  153. (emacs-lisp . t)))
  154. (require 'org-tempo)
  155. (add-to-list 'org-structure-template-alist '("s" . "src"))
  156. (add-to-list 'org-structure-template-alist '("q" . "quote"))
  157. (add-to-list 'org-structure-template-alist '("e" . "example"))
  158. (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
  159. (add-to-list 'org-structure-template-alist '("py" . "src python"))
  160. (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")))
  161. (use-package org-superstar
  162. :hook (org-mode . org-superstar-mode))
  163. (use-package org-roam
  164. :hook (after-init . org-roam-mode)
  165. :custom (org-roam-directory dotfiles/brain))
  166. (use-package org-roam-server
  167. :hook (org-roam-mode . org-roam-server-mode))
  168. (dotfiles/leader
  169. "r" '(:ignore t :which-key "Roam")
  170. "rf" '(org-roam-find-file :which-key "Find")
  171. "rb" '(org-roam-buffer-toggle-display :which-key "Buffer")
  172. "rc" '(org-roam-capture :which-key "Capture")
  173. "rd" '(:ignore t :which-key "Dailies")
  174. "rdd" '(org-roam-dailies-find-date :which-key "Date")
  175. "rdt" '(org-roam-dailies-find-today :which-key "Today")
  176. "rdm" '(org-roam-dailies-find-tomorrow :which-key "Tomorrow")
  177. "rdy" '(org-roam-dailies-find-yesterday :which-key "Yesterday"))
  178. (setq org-roam-capture-templates
  179. '(("d" "Default" plain (function org-roam-capture--get-point)
  180. "%?"
  181. :file-name "${slug}"
  182. :head "#+TITLE: ${title}\n"
  183. :unnarrowed t)))
  184. (setq org-roam-dailies-capture-templates
  185. '(("d" "Default" entry (function org-roam-capture--get-point)
  186. "* %?"
  187. :file-name "daily/%<%Y-%m-%d>"
  188. :head "#+TITLE: %<%Y-%m-%d>\n")))
  189. (setq org-agenda-files '("~/.local/source/brain/daily/"
  190. "~/.local/source/secrets/org/"))
  191. (dotfiles/leader
  192. "a" '(org-agenda :which-key "Agenda"))
  193. (use-package ox-hugo
  194. :after ox)
  195. (add-to-list 'org-roam-capture-templates
  196. '("b" "Blogging" plain (function org-roam-capture--get-point)
  197. "%?"
  198. :file-name "posts/${slug}"
  199. :head "#+TITLE: ${title}\n#+HUGO_BASE_DIR: ../\n#+HUGO_SECTION: ./\n"))
  200. (use-package ox-reveal
  201. :after ox
  202. :custom (org-reveal-root "https://cdn.jsdelivr.net/reveal.js/3.9.2/"))
  203. (add-to-list 'org-roam-capture-templates
  204. '("p" "Presentation" plain (function org-roam-capture--get-point)
  205. "%?"
  206. :file-name "slides/${slug}"
  207. :head "#+TITLE: ${title}\n"))