config.el.tmpl

  1;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
  2
  3(setq user-full-name "Amolith"
  4      user-mail-address "amolith@secluded.site")
  5
  6(setq doom-font (font-spec :family "{{ .font }}" :size 16)
  7      doom-variable-pitch-font (font-spec :family "{{ .font }}" :size 16))
  8
  9(setq doom-unicode-font (font-spec :family "Triplicate A Code"))
 10
 11(setq doom-theme 'catppuccin)
 12{{- if eq .theme_variant "dark"}}
 13(setq catppuccin-flavor 'macchiato)
 14{{- end }}
 15{{- if eq .theme_variant "light"}}
 16(setq catppuccin-flavor 'latte)
 17{{- end }}
 18
 19(setq display-line-numbers-type t)
 20
 21(use-package smooth-scrolling
 22    :ensure t
 23    :config
 24    (smooth-scrolling-mode 1)
 25    (setq smooth-scroll-margin 20))
 26
 27(global-prettify-symbols-mode t)
 28
 29(defun amo/split-window-below-and-switch ()
 30  "Split the window horizontally, then switch to the new pane."
 31  (interactive)
 32  (split-window-below)
 33  (balance-windows)
 34  (other-window 1))
 35(defun amo/split-window-right-and-switch ()
 36  "Split the window vertically, then switch to the new pane."
 37  (interactive)
 38  (split-window-right)
 39  (balance-windows)
 40  (other-window 1))
 41(global-set-key (kbd "C-x 2") 'amo/split-window-below-and-switch)
 42(global-set-key (kbd "C-x 3") 'amo/split-window-right-and-switch)
 43
 44(setq lsp-ui-doc-max-height 13)
 45(setq lsp-ui-doc-show-with-cursor t)
 46
 47(setq org-directory "~/Org/")
 48
 49(use-package org-bullets
 50    :init
 51  (add-hook 'org-mode-hook 'org-bullets-mode))
 52
 53(setq org-ellipsis " ⤵")
 54
 55(setq org-hide-emphasis-markers t)
 56
 57(setq org-adapt-indentation nil)
 58
 59(require 'ox-md)
 60(require 'ox-beamer)
 61
 62(setq org-confirm-babel-evaluate nil)
 63
 64(use-package htmlize)
 65
 66(setq org-export-with-smart-quotes t)
 67
 68(use-package helm-bibtex
 69    :custom
 70  (helm-bibtex-bibliography '("~/Documents/citations.bib"))
 71  (reftex-default-bibliography '("~/Documents/citations.bib"))
 72  (bibtex-completion-pdf-field "file")
 73  :hook (Tex . (lambda () (define-key Tex-mode-map "\C-ch" 'helm-bibtex))))
 74(use-package org-ref
 75    :custom
 76  (org-ref-default-bibliography "~/Documents/citations.bib"))
 77(defun org-export-latex-no-toc (depth)
 78  (when depth
 79    (format "%% Org-mode is exporting headings to %s levels.\n"
 80            depth)))
 81(setq org-export-latex-format-toc-function 'org-export-latex-no-toc)
 82(add-to-list 'org-latex-classes
 83             '("apa6"
 84               "\\documentclass{apa6}"
 85               ("\\section{%s}" . "\\section*{%s}")
 86               ("\\subsection{%s}" . "\\subsection*{%s}")
 87               ("\\subsubsection{%s}" . "\\subsubsection*{%s}")
 88               ("\\paragraph{%s}" . "\\paragraph*{%s}")
 89               ("\\subparagraph{%s}" . "\\subparagraph*{%s}")))
 90(setq org-latex-pdf-process
 91      '("latexmk -pdflatex='pdflatex -interaction nonstopmode' -pdf -bibtex -f %f"))
 92
 93(add-to-list 'auto-mode-alist '("/tmp/neomutt-*" . mail-mode))
 94
 95(setq TeX-PDF-mode t)
 96
 97(setq auto-mode-alist (cons '("\\.cho$" . chordpro-mode) auto-mode-alist))
 98(autoload 'chordpro-mode "chordpro-mode")
 99
100(defvar prose-modes
101  '(gfm-mode
102    git-commit-mode
103    markdown-mode
104    message-mode
105    mail-mode
106    org-mode
107    text-mode))
108(defvar prose-mode-hooks
109  (mapcar (lambda (mode) (intern (format "%s-hook" mode)))
110          prose-modes))
111
112(use-package flyspell
113    :config
114  (dolist (hook prose-mode-hooks)
115    (add-hook hook 'flyspell-mode)))
116
117(dolist (hook prose-mode-hooks)
118  (add-hook hook 'turn-on-auto-fill))
119
120(use-package markdown-mode
121    :commands gfm-mode
122    :mode (("\\.md$" . gfm-mode))
123    :config
124    (custom-set-faces
125     '(markdown-pre-face ((t nil))))
126    (setq markdown-command "pandoc --standalone --mathjax --from=markdown"
127          markdown-fontify-code-blocks-natively t))
128
129(defun amo/append-to-path (path)
130  (setenv "PATH" (concat (getenv "PATH") ":" path))
131  (add-to-list 'exec-path path))
132
133(amo/append-to-path "/usr/local/bin")
134(amo/append-to-path "~/.local/bin")
135
136(add-hook 'python-mode-hook 'auto-virtualenv-set-virtualenv)
137
138(gofmt-before-save)
139(setq lsp-go-use-placeholders nil)
140(setq lsp-go-use-gofumpt t)
141;;(setq lsp-go-build-flags ["mage"])
142
143(require 'sclang)
144(add-hook 'sclang-mode-hook 'sclang-extensions-mode)
145
146(setq tidal-boot-script-path "/usr/share/x86_64-linux-ghc-9.0.2/tidal-1.7.10/BootTidal.hs")
147
148(global-tree-sitter-mode)
149(add-hook 'tree-sitter-after-on-hook #'tree-sitter-hl-mode)
150
151(global-wakatime-mode)
152(setq wakatime-cli-path "/usr/bin/wakatime")
153
154(add-hook 'magit-mode-hook 'turn-on-magit-gitflow)
155
156(map! :leader :desc "Push upstream" "g p" #'magit-push-current-to-upstream)
157
158;;(use-package! copilot
159;;  :hook (prog-mode . copilot-mode)
160;;  :bind (("C-TAB" . 'copilot-accept-completion-by-word)
161;;         ("C-<tab>" . 'copilot-accept-completion-by-word)
162;;         :map copilot-completion-map
163;;         ("<tab>" . 'copilot-accept-completion)
164;;         ("TAB" . 'copilot-accept-completion)))
165
166(add-hook 'evil-local-mode-hook 'turn-on-undo-tree-mode)
167
168(after! mu4e (load "~/.config/doom/extra/mu4e.el"))
169
170(defun magit-am-apply-buffer (buffer &optional args)
171  "Apply the patch in BUFFER."
172  (interactive (list (read-buffer "Apply contents of buffer: ")
173                     (magit-am-arguments)))
174  (let ((patch
175         (with-current-buffer buffer
176           (buffer-substring-no-properties (point-min) (point-max)))))
177    (with-temp-buffer
178      (insert patch)
179      (magit-run-git-with-input
180       "am" args "-"))
181    (magit-refresh)))
182
183(use-package edit-server
184    :ensure t
185    :commands edit-server-start
186    :init (if after-init-time
187              (edit-server-start)
188              (add-hook 'after-init-hook
189                        #'(lambda() (edit-server-start))))
190    :config (setq edit-server-new-frame-alist
191                  '((name . "Edit with Emacs FRAME")
192                    (top . 200)
193                    (left . 200)
194                    (width . 80)
195                    (height . 25)
196                    (minibuffer . t)
197                    (menu-bar-lines . t)
198                    (window-system . x))))
199
200(use-package codeium
201    :init
202  (add-to-list 'completion-at-point-functions #'codeium-completion-at-point)
203  (add-hook 'emacs-startup-hook
204            (lambda () (run-with-timer 0.1 nil #'codeium-init)))
205
206  :config
207  ;; (setq use-dialog-box nil) ;; do not use popup boxes
208
209  ;; if you don't want to use customize to save the api-key
210  ;; (setq codeium/metadata/api_key "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx")
211
212  ;; get codeium status in the modeline
213  (setq codeium-mode-line-enable
214        (lambda (api) (not (memq api '(CancelRequest Heartbeat AcceptCompletion)))))
215  (add-to-list 'mode-line-format '(:eval (car-safe codeium-mode-line)) t)
216  ;; alternatively for a more extensive mode-line
217  ;; (add-to-list 'mode-line-format '(-50 "" codeium-mode-line) t)
218
219  (setq codeium-api-enabled
220        (lambda (api)
221          (memq api '(GetCompletions Heartbeat CancelRequest GetAuthToken RegisterUser auth-redirect AcceptCompletion))))
222
223  ;; You can overwrite all the codeium configs!
224  ;; for example, we recommend limiting the string sent to codeium for better performance
225  (defun my-codeium/document/text ()
226    (buffer-substring-no-properties (max (- (point) 3000) (point-min)) (min (+ (point) 1000) (point-max))))
227  ;; if you change the text, you should also change the cursor_offset
228  ;; warning: this is measured by UTF-8 encoded bytes
229  (defun my-codeium/document/cursor_offset ()
230    (codeium-utf8-byte-length
231     (buffer-substring-no-properties (max (- (point) 3000) (point-min)) (point))))
232  (setq codeium/document/text 'my-codeium/document/text)
233  (setq codeium/document/cursor_offset 'my-codeium/document/cursor_offset))