summaryrefslogtreecommitdiff
path: root/dot-config/emacs/config.org
blob: 263286963f2254c53fb851662c082b44fe62e15c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
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