diff --git a/emacs/custom.el b/emacs/custom.el deleted file mode 100644 index dd85b20..0000000 --- a/emacs/custom.el +++ /dev/null @@ -1,9 +0,0 @@ -;;; custom.el --- custom faces -;;; Commentary: -;;; Code: - -(custom-set-faces - '(hl-line ((t (:extend t :background "#3a3a3a")))) - '(line-number ((t (:background "#1d2021" :foreground "#7c6f64"))))) - -;;; custom.el ends here diff --git a/emacs/init.el b/emacs/init.el index fcc052c..212bc88 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -114,14 +114,6 @@ doom-modeline-bar-width 5 doom-modeline-persp-name t doom-modeline-persp-icon t)) -(custom-set-faces - '(org-level-1 ((t (:inherit outline-1 :height 1.7)))) - '(org-level-2 ((t (:inherit outline-2 :height 1.6)))) - '(org-level-3 ((t (:inherit outline-3 :height 1.5)))) - '(org-level-4 ((t (:inherit outline-4 :height 1.4)))) - '(org-level-5 ((t (:inherit outline-5 :height 1.3)))) - '(org-level-6 ((t (:inherit outline-5 :height 1.2)))) - '(org-level-7 ((t (:inherit outline-5 :height 1.1))))) ;; Keybinds (global-set-key (kbd "C-") 'next-buffer) @@ -141,7 +133,8 @@ :global-prefix "M-SPC") (tavo/leader-keys - "c" '(comment-line :wk "Comment lines"))) + "c" '(comment-line :wk "Comment lines") + "p" 'org-latex-preview)) ;; Extra (use-package company @@ -185,89 +178,21 @@ (lambda (&rest _) (display-line-numbers-mode -1))) (setq neo-theme nil) -;; Latex previews -(defvar org-latex-fragment-last nil - "Holds last fragment/environment you were on.") - -(defun org-latex-fragment-toggle () - "Toggle a latex fragment image " - (and (eq 'org-mode major-mode) - (let* ((el (org-element-context)) - (el-type (car el))) - (cond - ;; were on a fragment and now on a new fragment - ((and - ;; fragment we were on - org-latex-fragment-last - ;; and are on a fragment now - (or - (eq 'latex-fragment el-type) - (eq 'latex-environment el-type)) - ;; but not on the last one this is a little tricky. as you edit the - ;; fragment, it is not equal to the last one. We use the begin - ;; property which is less likely to change for the comparison. - (not (= (org-element-property :begin el) - (org-element-property :begin org-latex-fragment-last)))) - ;; go back to last one and put image back - (save-excursion - (goto-char (org-element-property :begin org-latex-fragment-last)) - (org-preview-latex-fragment)) - ;; now remove current image - (goto-char (org-element-property :begin el)) - (let ((ov (loop for ov in org-latex-fragment-image-overlays - if - (and - (<= (overlay-start ov) (point)) - (>= (overlay-end ov) (point))) - return ov))) - (when ov - (delete-overlay ov))) - ;; and save new fragment - (setq org-latex-fragment-last el)) - - ;; were on a fragment and now are not on a fragment - ((and - ;; not on a fragment now - (not (or - (eq 'latex-fragment el-type) - (eq 'latex-environment el-type))) - ;; but we were on one - org-latex-fragment-last) - ;; put image back on - (save-excursion - (goto-char (org-element-property :begin org-latex-fragment-last)) - (org-preview-latex-fragment)) - ;; unset last fragment - (setq org-latex-fragment-last nil)) - - ;; were not on a fragment, and now are - ((and - ;; we were not one one - (not org-latex-fragment-last) - ;; but now we are - (or - (eq 'latex-fragment el-type) - (eq 'latex-environment el-type))) - (goto-char (org-element-property :begin el)) - ;; remove image - (let ((ov (loop for ov in org-latex-fragment-image-overlays - if - (and - (<= (overlay-start ov) (point)) - (>= (overlay-end ov) (point))) - return ov))) - (when ov - (delete-overlay ov))) - (setq org-latex-fragment-last el)))))) - - -(add-hook 'post-command-hook 'org-latex-fragment-toggle) - -(setq org-highlight-latex-and-related '(latex script entities)) - +;; Org Mode (add-hook 'org-mode-hook 'org-indent-mode) (use-package org-bullets) (add-hook 'org-mode-hook (lambda () (org-bullets-mode 1))) +(custom-set-faces + '(org-level-1 ((t (:inherit outline-1 :height 1.7)))) + '(org-level-2 ((t (:inherit outline-2 :height 1.6)))) + '(org-level-3 ((t (:inherit outline-3 :height 1.5)))) + '(org-level-4 ((t (:inherit outline-4 :height 1.4)))) + '(org-level-5 ((t (:inherit outline-5 :height 1.3)))) + '(org-level-6 ((t (:inherit outline-5 :height 1.2)))) + '(org-level-7 ((t (:inherit outline-5 :height 1.1))))) +(setq org-highlight-latex-and-related '(latex script entities)) +(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.3)) +(setq org-startup-with-latex-preview t) (setq custom-file (concat user-emacs-directory "custom.el")) (load custom-file 'noerror)