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.

265 lines
7.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
  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/brain (concat dotfiles/src "brain"))
  12. (defvar dotfiles/home user-emacs-directory)
  13. (defvar dotfiles/cache "~/.cache/emacs")
  14. (setq create-lockfiles nil
  15. make-backup-files nil
  16. user-emacs-directory dotfiles/cache)
  17. (setq straight-repository-branch "develop"
  18. straight-use-package-by-default t)
  19. (defvar bootstrap-version)
  20. (let ((bootstrap-file
  21. (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
  22. (bootstrap-version 5))
  23. (unless (file-exists-p bootstrap-file)
  24. (with-current-buffer
  25. (url-retrieve-synchronously
  26. "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
  27. 'silent 'inhibit-cookies)
  28. (goto-char (point-max))
  29. (eval-print-last-sexp)))
  30. (load bootstrap-file nil 'nomessage))
  31. (straight-use-package 'use-package)
  32. (use-package no-littering)
  33. (setq inhibit-startup-message t)
  34. (global-prettify-symbols-mode)
  35. (scroll-bar-mode -1)
  36. (menu-bar-mode -1)
  37. (tool-bar-mode -1)
  38. (tooltip-mode -1)
  39. (set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size)
  40. (set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size)
  41. (set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size)
  42. (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
  43. (use-package which-key
  44. :diminish which-key-mode
  45. :init (which-key-mode)
  46. :config (setq which-key-idle-delay dotfiles/idle))
  47. (use-package general
  48. :config
  49. (general-create-definer dotfiles/leader
  50. :states '(normal motion)
  51. :keymaps 'override
  52. :prefix dotfiles/leader-key))
  53. (use-package hydra)
  54. (use-package evil
  55. :init (setq evil-want-integration t
  56. evil-want-keybinding nil)
  57. :config (evil-mode 1))
  58. (use-package evil-collection
  59. :after evil
  60. :config (evil-collection-init))
  61. (use-package evil-nerd-commenter
  62. :bind ("M-;" . evilnc-comment-or-uncomment-lines))
  63. (defhydra hydra-text-scale (:timeout 4)
  64. "Scale"
  65. ("j" text-scale-increase "Increase")
  66. ("k" text-scale-decrease "Decrease")
  67. ("f" nil "Finished" :exit t))
  68. (dotfiles/leader
  69. "f" '(hydra-text-scale/body :which-key "Font"))
  70. (dotfiles/leader
  71. "," '(switch-to-buffer :which-key "Buffer")
  72. "." '(find-file :which-key "File"))
  73. (dotfiles/leader
  74. "q" '(:ignore t :which-key "Quit")
  75. "qq" '(save-buffers-kill-emacs :which-key "Save")
  76. "qw" '(kill-emacs :which-key "Now"))
  77. (dotfiles/leader
  78. "w" '(:ignore t :which-key "Window")
  79. "ww" '(window-swap-states :which-key "Swap")
  80. "wd" '(kill-buffer-and-window :which-key "Delete")
  81. "wc" '(delete-window :which-key "Close")
  82. "wh" '(windmove-left :which-key "Left")
  83. "wj" '(windmove-down :which-key "Down")
  84. "wk" '(windmove-up :which-key "Up")
  85. "wl" '(windmove-right :which-key "Right")
  86. "ws" '(:ignore t :which-key "Split")
  87. "wsj" '(split-window-below :which-key "Down")
  88. "wsl" '(split-window-right :which-key "Right"))
  89. (use-package linum-relative
  90. :init (setq linum-relative-backend
  91. 'display-line-numbers-mode)
  92. :config (linum-relative-global-mode))
  93. (use-package rainbow-delimiters
  94. :hook (prog-mode . rainbow-delimiters-mode))
  95. (use-package magit
  96. :custom (magit-display-buffer-function
  97. #'magit-display-buffer-same-window-except-diff-v1))
  98. (use-package forge)
  99. (dotfiles/leader
  100. "g" '(magit-status :which-key "Magit"))
  101. (use-package all-the-icons)
  102. (use-package all-the-icons-dired
  103. :hook (dired-mode . all-the-icons-dired-mode))
  104. (require 'dired-x)
  105. (dotfiles/leader
  106. "d" '(dired-jump :which-key "Dired"))
  107. (use-package eshell-prompt-extras
  108. :config (setq eshell-highlight-prompt nil
  109. eshell-prompt-function 'epe-theme-lambda))
  110. (dotfiles/leader
  111. "e" '(eshell :which-key "Shell"))
  112. (use-package doom-themes
  113. :init (load-theme 'doom-moonlight t))
  114. (dotfiles/leader
  115. "t" '(load-theme t nil :which-key "Theme"))
  116. (use-package doom-modeline
  117. :init (doom-modeline-mode 1)
  118. :custom ((doom-modeline-height 16)))
  119. (use-package org
  120. :hook
  121. (org-mode . (lambda ()
  122. (org-indent-mode)
  123. (visual-line-mode 1)
  124. (variable-pitch-mode 1)))
  125. :config
  126. (setq org-ellipsis ""
  127. org-log-done 'time
  128. org-log-into-drawer t
  129. org-src-preserve-indentation t)
  130. (org-babel-do-load-languages
  131. 'org-babel-load-languages
  132. '((shell . t)
  133. (python . t)
  134. (emacs-lisp . t)))
  135. (require 'org-tempo)
  136. (add-to-list 'org-structure-template-alist '("s" . "src"))
  137. (add-to-list 'org-structure-template-alist '("q" . "quote"))
  138. (add-to-list 'org-structure-template-alist '("e" . "example"))
  139. (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
  140. (add-to-list 'org-structure-template-alist '("py" . "src python"))
  141. (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")))
  142. (use-package org-superstar
  143. :hook (org-mode . org-superstar-mode))
  144. (use-package lsp-mode
  145. :commands lsp
  146. :config
  147. (setq gc-cons-threshold 100000000
  148. lsp-completion-provider 'company-capf
  149. lsp-idle-delay dotfiles/idle))
  150. (use-package lsp-ui
  151. :commands lsp-ui-mode
  152. :custom (lsp-ui-doc-position 'at-point))
  153. (use-package dap-mode)
  154. (use-package company-lsp
  155. :commands company-lsp
  156. :custom (company-minimum-prefix-length 1))
  157. (use-package python-mode
  158. :hook (python-mode . lsp)
  159. :config (require 'dap-python)
  160. :custom (python-shell-interpreter "python3") ;; Required if "python" is not python 3.
  161. (dap-python-executable "python3") ;; Same as above.
  162. (dap-python-debugger 'debugpy))
  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-ley "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/secrets/"
  190. "~/.local/source/brain/daily/"))
  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" "blog" 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. '("s" "slides" plain (function org-roam-capture--get-point)
  205. "%?"
  206. :file-name "slides/${slug}"
  207. :head "#+TITLE: ${title}\n"))