diff options
Diffstat (limited to 'dot-config/emacs/config.org')
| -rw-r--r-- | dot-config/emacs/config.org | 230 |
1 files changed, 230 insertions, 0 deletions
diff --git a/dot-config/emacs/config.org b/dot-config/emacs/config.org new file mode 100644 index 0000000..2632869 --- /dev/null +++ b/dot-config/emacs/config.org @@ -0,0 +1,230 @@ +#+TITLE: Jose's Emacs Config + +Setup property for all code-blocks to tangle by default +#+PROPERTY: header-args:emacs-lisp :tangle yes + +* Init +** Package and sources and init +Add MELPA and the https version of elps to the package sources. + +This should preferrably be done in the init-file, before this file is loaded to allow for byte-compiling. +#+BEGIN_SRC emacs-lisp :tangle no +(require 'package) +(setq-default package-archives + '(("gnu" . "https://elpa.gnu.org/packages/") + ("melpa" . "https://melpa.org/packages/"))) + +(setq-default package-enable-at-startup nil) +(package-initialize) +#+END_SRC + +** Set up use-package and install if missing +This should preferrably be done in the init-file, before this file is loaded to allow for byte-compiling. +#+BEGIN_SRC emacs-lisp :tangle no +(unless (package-installed-p 'use-package) + (progn + (package-refresh-contents) + (package-install 'use-package))) + +(require 'use-package) +#+END_SRC + +* Utils +** Evil +Because I'm a vimmer. +Install the evil package if it is not installed, and call it once it has loaded. +`evil-want-C-i-jump` to 'nil fixes an issue where evil breaks tabs in org-mode src code +Thank you to this article for the fix: https://jeffkreeftmeijer.com/emacs-evil-org-tab/ +#+BEGIN_SRC emacs-lisp +(use-package evil + :ensure t + :init + ;; set this to nil because it breaks tabs in org-mode + (setq evil-want-C-i-jump 'nil) + :config + (evil-mode)) +#+END_SRC + +** pdf-tools +for viewing PDFs in emacs +#+begin_src emacs-lisp +(use-package pdf-tools + :ensure t + :config + (pdf-tools-install)) + +(add-hook 'pdf-view-mode-hook + (lambda () + ;; Disable line numbers for pdfs + (display-line-numbers-mode -1) + ;; Enable midnight mode (dark mode) by default + (pdf-view-midnight-minor-mode 1))) +#+end_src + +* Modes +** markdown +Major mode for editing Markdown files +#+begin_src emacs-lisp +(use-package markdown-mode + :ensure) +#+end_src + +** nov.el +Major mode for reading EPUBs +#+begin_src emacs-lisp +(use-package nov + :ensure) +#+end_src + +* Fixes +** Org Source Code Auto-Indent +By default, src-blocks are auto-indented 2 spaces. This breaks certain languages, as org-mode will continuously add 2 spaces on enter inside of some expressions. +Setting indentation to 0 fixes the issue. +#+BEGIN_SRC emacs-lisp +(setq org-edit-src-content-indentation 0) +#+END_SRC + +** Org Inline Images +By default, Org mode displays inline images according to their actual width. By changing this value to nil, org will try to get the width from an ‘#+ATTR.*’ keyword and fall back on the original width if none is found. +#+begin_src emacs-lisp +(setq org-image-actual-width 'nil) +#+end_src + +By default, inline images are not displayed, and must be toggled on with *C-c C-x C-v (org-toggle-inline-images)*. +With this we ask for inline images to be displayed at startup. +#+begin_src emacs-lisp +(setq org-startup-with-inline-images t) +#+end_src + +** Org Latex Preview +The org latex preview from within org files is too small by default. +#+begin_src emacs-lisp +(setq org-format-latex-options + (plist-put org-format-latex-options + :scale 2)) +#+end_src + +Org latex preview uses 'divpng by default, which is blurry. +Here we switch to 'dvivgm +#+begin_src emacs-lisp +(setq org-latex-create-formula-image-program 'dvisvgm) +#+end_src + +* Looks +** Theme +#+BEGIN_SRC emacs-lisp +(use-package gruvbox-theme + :ensure + :demand) + +(use-package ef-themes + :ensure + :demand) + +;; overrides just to make it a little less purple-y +(setq ef-winter-palette-overrides + '((bg-main "#101010") + (bg-mode-line bg-tab-bar))) + +(use-package modus-themes + :ensure + :demand) + +(setq modus-themes-common-palette-overrides modus-themes-preset-overrides-faint) + +(setq modus-vivendi-palette-overrides + '((bg-main "#1E1E1E") + (fg-main "#DCDCDC") + (fg-heading-1 blue-faint) + (fg-heading-2 magenta-faint) + (fg-heading-3 cyan-faint) + (fg-heading-4 gold) + (fg-heading-5 olive) + (fg-heading-6 slate) + (fg-heading-7 indigo) + (fg-heading-8 pink) + (bg-prose-block-contents "#323232") + (bg-prose-block-delimiter "#323232") + (border-mode-line-active "#000000") + (border-mode-line-inactive "#000000"))) + +(setq modus-themes-bold-constructs t) +(setq modus-themes-italic-constructs t) + +(load-theme 'modus-vivendi) +#+END_SRC + +** Font +#+BEGIN_SRC emacs-lisp +(add-to-list 'default-frame-alist + '(font . "iosevka nerd font-16")) +#+END_SRC + +* UI +** Starutp Screen +Disable the startup screen +#+BEGIN_SRC emacs-lisp +(setq inhibit-startup-screen t) +(setq inhibit-startup-message t) +(setq inhibit-startup-echo-area-message t) +#+END_SRC + +** Bars +Disable the menu bar, tool bar, and scroll bar. +#+BEGIN_SRC emacs-lisp +(menu-bar-mode -1) +(tool-bar-mode -1) +(scroll-bar-mode -1) +#+END_SRC + +** Cursor +Disable the blinking cursor +#+BEGIN_SRC emacs-lisp +(blink-cursor-mode -1) +#+END_SRC + +** Scrolling +Scroll only one line (instead of jumping like it does by default) +#+BEGIN_SRC emacs-lisp +(setq scroll-conservatively most-positive-fixnum) +#+END_SRC + +** Line Numbers +Display line numbers, and let the current line be 0 instead of its actual value +#+BEGIN_SRC emacs-lisp +(setq display-line-numbers-type 'relative + display-line-numbers-current-absolute 'nil) +(global-display-line-numbers-mode t) +#+END_SRC + +** Bell +The bell sound is so annoying to me. Disable it. +Future consideration: visible bell is available, but it is big and ugly. Maybe customize in the future. +#+BEGIN_SRC emacs-lisp +(setq ring-bell-function 'ignore) +#+END_SRC + +* UX +** Org Agenda +Custom org agenda views +#+begin_src emacs-lisp +(setq org-agenda-custom-commands + '(("w" "my weekly" agenda "" + ((org-agenda-span 365) + (org-agenda-time-grid nil) + (org-agenda-repeating-timestamp-show-all t) + (org-agenda-entry-types '(:timestamp :sexp)))) + )) +#+end_src +* Languages +#+BEGIN_SRC emacs-lisp +(org-babel-do-load-languages + 'org-babel-load-languages + '((python . t))) +#+END_SRC + +configure python +#+begin_src emacs-lisp +(setq python-indent-offset 4 + python-indent-guess-indent-offset 'nil) +#+end_src |
