This commit is contained in:
tavo-wasd 2024-06-22 08:26:36 -06:00
parent 8287ec9d33
commit 26b18e3fa0

View file

@ -4,18 +4,23 @@
;;; M-x all-the-icons-install-fonts ;;; M-x all-the-icons-install-fonts
;;; Code: ;;; Code:
;; Prerequisites ;; --- Prerequisites ----
; (unless (file-directory-p "~/.config/emacs/elpa/gnupg") ; (unless (file-directory-p "~/.config/emacs/elpa/gnupg")
; (make-directory "~/.config/emacs/elpa/gnupg") ; (make-directory "~/.config/emacs/elpa/gnupg")
; (shell-command "gpg --homedir ~/.config/emacs/elpa/gnupg --keyserver hkp://keyserver.ubuntu.com --recv-keys 645357D2883A0966") ; (shell-command "gpg --homedir ~/.config/emacs/elpa/gnupg --keyserver hkp://keyserver.ubuntu.com --recv-keys 645357D2883A0966")
; (shell-command "find ~/.config/emacs/elpa/gnupg -type d -exec chmod 700 {} \;") ; (shell-command "find ~/.config/emacs/elpa/gnupg -type d -exec chmod 700 {} \;")
; (shell-command "find ~/.config/emacs/elpa/gnupg -type f -exec chmod 600 {} \;")) ; (shell-command "find ~/.config/emacs/elpa/gnupg -type f -exec chmod 600 {} \;"))
(unless (file-directory-p "~/.local/share/emacs/lock") (unless (file-directory-p "~/.local/share/emacs/lock")
(make-directory "~/.local/share/emacs/lock")) (make-directory "~/.local/share/emacs/lock"))
(unless (file-directory-p "~/.local/share/emacs/backup") (unless (file-directory-p "~/.local/share/emacs/backup")
(make-directory "~/.local/share/emacs/backup")) (make-directory "~/.local/share/emacs/backup"))
;; ---
;; Preferences ;; --- Preferences ---
(setq custom-file (concat user-emacs-directory "custom.el"))
(load custom-file 'noerror)
(setq warning-minimum-level :error) (setq warning-minimum-level :error)
(setq scroll-step 1 scroll-conservatively 10000) (setq scroll-step 1 scroll-conservatively 10000)
(scroll-bar-mode 0) (scroll-bar-mode 0)
@ -32,27 +37,39 @@
(setq temporary-file-directory "~/.local/share/emacs/lock") (setq temporary-file-directory "~/.local/share/emacs/lock")
(dolist (mode '(org-mode-hook term-mode-hook shell-mode-hook eshell-mode-hook)) (dolist (mode '(org-mode-hook term-mode-hook shell-mode-hook eshell-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0)))) (add-hook mode (lambda () (display-line-numbers-mode 0))))
;; ---
;; Package manager ;; --- Package manager ---
(require 'package) (require 'package)
(setq package-archives '(("melpa" . "https://melpa.org/packages/"))) (setq package-archives '(("melpa" . "https://melpa.org/packages/")))
(package-initialize) (package-initialize)
(unless package-archive-contents (unless package-archive-contents
(package-refresh-contents)) (package-refresh-contents))
(unless (package-installed-p 'use-package) (unless (package-installed-p 'use-package)
(package-install 'use-package)) (package-install 'use-package))
(require 'use-package) (require 'use-package)
(setq use-package-always-ensure t) (setq use-package-always-ensure t)
(dolist (pkg '(all-the-icons nerd-icons markdown-mode markdown-preview-mode)) (dolist (pkg '(all-the-icons nerd-icons markdown-mode markdown-preview-mode))
(unless (package-installed-p pkg) (unless (package-installed-p pkg)
(package-install pkg))) (package-install pkg)))
;; ---
;; --- Theming ---
(if (eq system-type 'android)
(set-face-attribute 'default nil :height 140) ;; Android
(progn ;; Everywhere else
(set-face-attribute 'default nil :font "JetBrains Mono")
(add-to-list 'default-frame-alist '(font . "JetBrains Mono-10"))))
;; Theming
(set-face-attribute 'default nil :font "JetBrains Mono")
(add-to-list 'default-frame-alist '(font . "JetBrains Mono-10"))
(use-package doom-themes (use-package doom-themes
:init (load-theme 'doom-material t)) :init (load-theme 'doom-material t))
;; ---
(use-package paren :ensure nil (use-package paren :ensure nil
:init (setq show-paren-delay 0) :init (setq show-paren-delay 0)
@ -65,22 +82,30 @@
(setq dashboard-set-file-icons t) (setq dashboard-set-file-icons t)
(setq dashboard-center-content t) (setq dashboard-center-content t)
(setq dashboard-vertically-center-content t) (setq dashboard-vertically-center-content t)
(setq dashboard-startupify-list '(dashboard-insert-banner
dashboard-insert-banner-title (if (eq system-type 'android)
dashboard-insert-items)) (progn ;; Android
(setq dashboard-startup-banner "~/.config/emacs/banner.txt") (setq dashboard-startupify-list '(dashboard-insert-banner dashboard-insert-items))
(setq dashboard-banner-logo-title "✨ M'illumino d'immenso ✨") (setq dashboard-startup-banner 'logo))
(progn ;; Everywhere else
(setq dashboard-startupify-list '(dashboard-insert-banner
dashboard-insert-banner-title
dashboard-insert-items))
(setq dashboard-startup-banner "~/.config/emacs/banner.txt")
(setq dashboard-banner-logo-title "✨ M'illumino d'immenso ✨")))
(setq dashboard-items '((recents . 5))) (setq dashboard-items '((recents . 5)))
:config :config
(dashboard-setup-startup-hook)) (dashboard-setup-startup-hook))
(setq initial-buffer-choice (lambda () (get-buffer-create dashboard-buffer-name))) (setq initial-buffer-choice (lambda () (get-buffer-create dashboard-buffer-name)))
(use-package evil (use-package evil
:init :init
(setq evil-want-integration t (setq evil-want-integration t
evil-want-keybinding nil evil-want-keybinding nil
evil-vsplit-window-right t evil-vsplit-window-right t
evil-split-window-below t evil-split-window-below t
evil-undo-system 'undo-redo) evil-undo-system 'undo-redo)
:config :config
(evil-mode 1)) (evil-mode 1))
@ -89,7 +114,7 @@
:config :config
(evil-collection-init)) (evil-collection-init))
;; Org Mode ;; --- Org Mode ---
(use-package org-bullets) (use-package org-bullets)
(add-hook 'org-mode-hook (lambda () (org-indent-mode))) (add-hook 'org-mode-hook (lambda () (org-indent-mode)))
(custom-set-faces (custom-set-faces
@ -97,19 +122,43 @@
'(org-level-2 ((t (:inherit outline-2 :height 1.5)))) '(org-level-2 ((t (:inherit outline-2 :height 1.5))))
'(org-level-3 ((t (:inherit outline-3 :height 1.3)))) '(org-level-3 ((t (:inherit outline-3 :height 1.3))))
'(org-level-4 ((t (:inherit outline-4 :height 1.1))))) '(org-level-4 ((t (:inherit outline-4 :height 1.1)))))
(setq org-format-latex-options (plist-put org-format-latex-options :scale 1.35)) (setq org-format-latex-options (plist-put org-format-latex-options :scale 1.35))
(setq org-latex-toc-command "\\clearpage \\tableofcontents \\clearpage") (setq org-latex-toc-command "\\clearpage \\tableofcontents \\clearpage")
(setq org-highlight-latex-and-related '(latex script entities)) (setq org-highlight-latex-and-related '(latex script entities))
(setq org-startup-with-latex-preview t) (setq org-startup-with-latex-preview t)
(defun efs/org-mode-visual-fill () (defun my/org-mode-visual-fill ()
(setq visual-fill-column-width 100 (setq visual-fill-column-width 100
visual-fill-column-center-text t) visual-fill-column-center-text t)
(visual-fill-column-mode 1)) (visual-fill-column-mode 1))
(use-package visual-fill-column
:hook (org-mode . efs/org-mode-visual-fill))
;; Keybinds (if (eq system-type 'android)
(message "Android device, ignoring org-mode-visual-fill") ;; Android
(progn ;; Everywhere else
(use-package visual-fill-column
:hook (org-mode . my/org-mode-visual-fill))))
(if (eq system-type 'android)
(progn ;; Android custom org-latex-preview
(setq org-preview-latex-process-alist
'((texpngweb
:programs ("curl")
:description "tex > png"
:message "you need to install curl."
:image-input-type "tex"
:image-output-type "png"
:image-size-adjust (1.0 . 1.0)
;; This works in my pc, but not in android.
;; :latex-compiler ("curl -F \"file=@%f\" http://0.0.0.0:8000")
;; For some reason this works in android (and also on pc)
;; And for whatever reason image-converter still needs to be set
:latex-compiler ("curl -F \"file=@%f\" http://0.0.0.0:8000 && curl http://0.0.0.0:8000/tmp.png -o %O")
:image-converter ("curl http://0.0.0.0:8000/tmp.png -o %O"))))
(setq org-latex-create-formula-image-program 'texpngweb)))
;; ---
;; --- Keybinds ---
(use-package general (use-package general
:config :config
(general-evil-setup) (general-evil-setup)
@ -132,8 +181,7 @@
(define-key evil-motion-state-map (kbd "RET") nil) (define-key evil-motion-state-map (kbd "RET") nil)
(define-key evil-motion-state-map (kbd "TAB") nil)) (define-key evil-motion-state-map (kbd "TAB") nil))
(setq org-return-follows-link t) (setq org-return-follows-link t)
;; ---
(setq custom-file (concat user-emacs-directory "custom.el")) (message "init.el loaded successfully")
(load custom-file 'noerror)
;; init.el ends here ;; init.el ends here