-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.el
359 lines (290 loc) · 14.2 KB
/
config.el
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
;;; $DOOMDIR/config.el -*- lexical-binding: t; -*-
;; Place your private configuration here! Remember, you do not need to run 'doom
;; sync' after modifying this file!
;; Some functionality uses this to identify you, e.g. GPG configuration, email
;; clients, file templates and snippets.
(setq user-full-name "Jonathan Sahar"
user-mail-address "[email protected]")
;; Doom exposes five (optional) variables for controlling fonts in Doom. Here
;; are the three important ones:
;;
;; + `doom-font'
;; + `doom-variable-pitch-font'
;; + `doom-big-font' -- used for `doom-big-font-mode'; use this for
;; presentations or streaming.
;;
;; They all accept either a font-spec, font string ("Input Mono-12"), or xlfd
;; font string. You generally only need these two:
;; (setq doom-font (font-spec :family "monospace" :size 12 :weight 'semi-light)
;; doom-variable-pitch-font (font-spec :family "sans" :size 13))
;; (setq doom-font
(setq
doom-font (font-spec :family "NotoMono" :size 20)
;; doom-font (font-spec :family "Source Code Pro" :size 18)
;; doom-font (font-spec :family "Alef" :size 20)
doom-big-font (font-spec :family "NotoMono" :size 20)
;; doom-big-font (font-spec :family "JetBrains Mono" :size 20)
;; doom-variable-pitch-font (font-spec :family "Source Code Pro" :size 20)
doom-variable-pitch-font (font-spec :family "NotoSans" :size 20)
doom-unicode-font (font-spec :name "NotoMono" :size 20))
;; (custom-theme-set-faces 'user
;; '(variable-pitch ((t (:family "ETBembo" :height 180 :weight thin))))
;; '(fixed-pitch ((t ( :family "Fira Code Retina" :height 200))))))
;; There are two ways to load a theme. Both assume the theme is installed and
;; available. You can either set `doom-theme' or manually load a theme with the
;; `load-theme' function. This is the default:
(setq doom-theme 'doom-one-light)
;;(setq doom-theme 'doom-vibrant)
;;
;; If you use `org' and don't want your org files in the default location below,
;; change `org-directory'. It must be set before org loads!
(setq org-directory "~/google_drive/notes/slip-box")
;;
;; This determines the style of line numbers in effect. If set to `nil', line
;; numbers are disabled. For relative line numbers, set this to `relative'.
(setq-default display-line-numbers-type 'relative)
;; Here are some additional functions/macros that could help you configure Doom:
;;
;; - `load!' for loading external *.el files relative to this one
;; - `use-package!' for configuring packages
;; - `after!' for running code after a package has loaded
;; - `add-load-path!' for adding directories to the `load-path', relative to
;; this file. Emacs searches the `load-path' when you load packages with
;; `require' or `use-package'.
;; - `map!' for binding new keys
;;
;; To get information about any of these functions/macros, move the cursor over;; the highlighted symbol at press 'K' (non-evil users must press 'C-c c k').
;; This will open documentation for it, including demos of how they are used.
;;
;; You can also try 'gd' (or 'C-c c d') to jump to their definition and see how
;; they are implemented.
;; various settings
(setq
bibliography-pdf-dir (list "~/google_drive/.bibliography/zotero_pdf")
bibliography-files '("~/google_drive/.bibliography/references.bib" ) ;
;; bibliography-files '( "~/google_drive/.bibliography/motor-cognition.bib" "~/google_drive/.bibliography/consciousness.bib" "~/google_drive/.bibliography/methods.bib" )
notes-dir (concat (getenv "HOME") "/google_drive/notes/")
gtd-dir (concat notes-dir "gtd/")
slip-box-dir (concat notes-dir "slip-box/")
literature-notes-dir (list "~/google_drive/notes/slip-box/literature-notes/")
org-my-anki-file (concat slip-box-dir "anki.org")
org-capture-papers-file (concat slip-box-dir "2021-06-17-papers_by_subject.org")
org-capture-meeting-file (concat slip-box-dir "2020-10-22-meeting_summaries.org")
org-capture-inbox-file (concat gtd-dir "inbox.org")
org-capture-reminders-file (concat gtd-dir "reminders.org")
org-capture-projects-file (concat gtd-dir "projects.org")
org-capture-someday-file (concat gtd-dir "someday.org")
org-capture-writing-inbox-file (concat slip-box-dir "writing-inbox.org")
org-directory notes-dir
;; org-roam-directory "~/slip-box"
org-roam-directory slip-box-dir
evil-respect-visual-line-mode 't
delete-by-moving-to-trash nil ; Delete files to trash
uniquify-buffer-name-style nil ; Uniquify buffer names
window-combination-resize t ; take new window space from all other windows (not just current)
x-stretch-cursor t ; Stretch cursor to the glyph width
undo-limit 80000000 ; Raise undo-limit to 80Mb
evil-want-fine-undo t ; By default while in insert all changes are one big blob. Be more granular
garbage-collection-messages t
auto-save-default t ; Nobody likes to lose work, I certainly don't
inhibit-compacting-font-caches t ; When there are lots of glyphs, keep them in memory
backup-directory-alist `(("." . ,(concat user-emacs-directory "autosaved_files")))
truncate-string-ellipsis "…") ; Unicode ellispis are nicer than "...", and also save /precious/ space
(setq trash-directory "~/trashed-files-from-emacs/")
(setq browse-url-filename-alist '(("^/\\(ftp@\\|anonymous@\\)?\\([^:/]+\\):/*" . "ftp://\\2/") ("^/\\([^:@/]+@\\)?\\([^:/]+\\):/*" . "ftp://\\1\\2/") ("^/+" . "file:///") ("mnt/g" . "G:")))
;; (add-to-list browse-url-filename-alist (quote("mnt/g" . "G:")))
(load! "package-config.el")
(load! "my-functions.el")
(load! "faces.el")
(load! "keybindings.el")
(setq which-key-idle-delay 0.2
which-key-idle-secondary-delay 0.1
which-key-allow-multiple-replacements t)
(setq-default evil-shift-width 4 ; globally
tab-width 4) ; globally
(setq evil-shift-width 4
tab-width 4)
(delete-selection-mode 1) ; Replace selection when inserting text
(display-time-mode 1) ; Enable time in the mode-line
(display-battery-mode 1) ; On laptops it's nice to know how much power you have
(global-subword-mode 1) ; Iterate through CamelCase words
(setq-default major-mode 'org-mode)
(if (eq initial-window-system 'x) ; if started by emacs command or desktop file
(toggle-frame-maximized)
(toggle-frame-fullscreen))
(setq
visual-fill-column-width 90
split-window-preferred-function 'visual-fill-column-split-window-sensibly
dired-dwim-target t
evil-vsplit-window-right t
evil-split-window-below t)
(remove-hook 'text-mode-hook #'auto-fill-mode)
(defun my/snipe_ivy ()
(evilem-create (list 'evil-snipe-repeat
'evil-snipe-repeat-reverse)
:bind ((evil-snipe-scope 'buffer)
(evil-snipe-enable-highlight)
(evil-snipe-enable-incremental-highlight))))
(map! :map evil-snipe-parent-transient-map "C-;" #'my/snipe_ivy )
(custom-set-variables
'(helm-ag-base-command "rg --no-heading")
`(helm-ag-success-exit-status '(0 2)))
(setq-default evil-escape-delay 0.4)
;; set the browser location
(setq browse-url-browser-function 'browse-url-generic browse-url-generic-program "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe")
(defun my/org-mode-hook()
(interactive)
(my/org-hide-properties-display)
(setq after-save-hook '(flycheck-handle-save t ))
(sp-pair "$" "$")
)
(font-lock-add-keywords nil '(("\"\\(\\(?:.\\|\n\\)*?[^\\]\\)\"" 0 font-lock-string-face)))
(add-hook! org-agenda-mode #'writeroom-mode)
(add-hook! org-roam-mode #'visual-line-mode)
(add-hook! org-mode #'flyspell-mode #'org-superstar-mode #'my/org-mode-hook) ;;#'writeroom-mode #'org-hide-properties)
(add-hook 'text-mode-hook (lambda ()
(setq bidi-paragraph-direction nil)
(setq bidi-paragraph-start-re "^")
(setq bidi-paragraph-separate-re "^")
(setq captain-predicate (lambda () t))
(visual-fill-column-mode 1)
(visual-line-mode 1)
(flyspell-mode 1)
(captain-mode 1)
(abbrev-mode 1)
(font-lock-mode 1)
(buffer-face-mode)
;; (my/set-faces)
;; (my/org-font)
))
(add-hook 'prog-mode-hook (lambda ()
(setq helm-ff-fuzzy-matching t)
(setq captain-predicate (lambda () (nth 8 (syntax-ppss (point)))))
))
(evil-snipe-override-mode 1)
;; (my/set-faces)
(require 'org-download)
;; (add-hook 'after-init-hook 'company-statistics-mode)
(customize-set-value
'org-agenda-category-icon-alist
`(
("research" "~/google_drive/icons/calendar.svg" nil nil :ascent center)
("school" "~/google_drive/icons/calendar.svg" nil nil :ascent center)
("personal" "~/google_drive/icons/checklist.svg" nil nil :ascent center)
("home" "~/google_drive/icons/checklist.svg" nil nil :ascent center)
("todo" "~/google_drive/icons/checklist.svg" nil nil :ascent center)
("bills" "~/google_drive/icons/money-bag.svg" nil nil :ascent center)
("downtown" "~/google_drive/icons/013-buildings.svg" nil nil :ascent center)
("emacs" "~/google_drive/icons/014-coding.svg" nil nil :ascent center)
))
;; (add-to-list 'load-path "/home/jonathan/wordnut")
;; (require 'wordnut)
(add-to-list 'load-path "/home/jonathan/.emacs.d/orgnv")
(load "orgnv.el")
(require 'orgnv)
(setq orgnv-directories '("/home/jonathan/google_drive/notes/slip-box"))
(add-hook 'occur-mode-hook
(defun occur-show-replace-context+ ()
(add-hook 'replace-update-post-hook
'occur-mode-display-occurrence nil 'local)))
(define-advice occur-mode-display-occurrence
(:around (fun &rest args) save-match-data)
(save-match-data
(apply fun args)))
;; completion
(setq company-idle-delay 0.5
company-minimum-prefix-length 2
company-show-numbers t)
(setq-default history-length 1000)
(setq-default prescient-history-length 1000)
(map! :map org-mode-map :i
"C-;" #'+company/complete
"M-;" #'+company/complete)
(set-company-backend! 'text-mode 'company-dabbrev 'company-ispell)
;; (set-company-backend! 'text-mode 'company-capf)
(set-company-backend! 'prog-mode '(company-files))
(set-company-backend! 'emacs-lisp-mode '(company-files))
(add-hook 'bibtex-mode-hook 'my/convert-windows-to-linux-paths)
(add-hook 'text-mode-hook (lambda ()
(setq-local company-backends '(company-wordfreq))
(setq-local company-transformers nil)))
(defadvice! prompt-for-buffer (&rest _)
:after 'evil-window-vsplit (switch-to-buffer))
;; LaTeX configuration
(setq TeX-auto-save t)
(setq TeX-parse-self t)
(setq-default TeX-master nil)
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'TeX-source-correlate-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
(setq TeX-PDF-mode t)
(setq TeX-output-view-style
(quote
(("^pdf$" "." "evince -f %o")
("^html?$" "." "iceweasel %o"))))
(setq initial-major-mode 'org-mode)
(setq helm-ff-fuzzy-matching t)
(set-input-method 'hebrew-full)
(remove-hook 'after-save-hook #'ws-butler-after-save) ;
;; (add-hook 'after-init-hook 'company-statistics-mode)
;; (my-generic-ispell-company-complete-setup)
(defun my/dedicate-org-roam-buffer ()
(add-to-list 'display-buffer-alist
'("\\*org-roam\\*"
(display-buffer-in-side-window)
(dedicated . t)
(side . right)
(slot . 0)
(window-width . 0.33)
(window-parameters . ((no-other-window . t)
(no-delete-other-windows . t)))))
)
(my/dedicate-org-roam-buffer)
(setq
org-cite-global-bibliography bibliography-files
org-cite-insert-processor 'citar)
;; (setq org-cite-csl-styles-dir "~/Zotero/styles")
(advice-add #'completing-read-multiple :override #'consult-completing-read-multiple)
(defun with-minibuffer-keymap (keymap)
(lambda (fn &rest args)
(minibuffer-with-setup-hook
(lambda ()
(use-local-map
(make-composed-keymap keymap (current-local-map))))
(apply fn args))))
(defvar embark-completing-read-prompter-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "<tab>") 'abort-recursive-edit)
map))
;; (advice-add 'embark-completing-read-prompter :around
;; (with-minibuffer-keymap embark-completing-read-prompter-map))
;; (define-key vertico-map (kbd "C-<tab>") 'embark-act-with-completing-read)
(defun embark-act-with-completing-read (&optional arg)
(interactive "P")
(let* ((embark-prompter 'embark-completing-read-prompter)
(act (propertize "Act" 'face 'highlight))
(embark-indicator (lambda (_keymap targets) nil)))
(embark-act arg)))
;; (advice-add #'completing-read-multiple :override #'conult-completing-read-multiple)
(setq org-odt-preferred-output-format "docx")
(defun my/make-small-frame () (interactive) (set-frame-size (selected-frame) 50 42))
(defun my/make-medium-frame () (interactive) (set-frame-size (selected-frame) 90 42))
(defun my/make-large-frame () (interactive) (set-frame-size (selected-frame) 120 42))
(add-to-list 'default-frame-alist '(height . 40))
(add-to-list 'default-frame-alist '(width . 90))
(setq org-id-link-to-org-use-id 'create-if-interactive)
(setq python-shell-prompt-detect-failure-warning nil)
(setq lsp-pylsp-plugins-flake8-max-line-length 90)
(setq lsp-pylsp-plugins-flake8-enabled nil)
(setq lsp-pylsp-plugins-autopep8-enabled nil)
(setq which-key-idle-delay 2)
(defmacro csetq (variable value)
`(funcall (or (get ',variable 'custom-set)
'set-default)
',variable ,value))
(setq ediff-forward-word-function 'forward-char)
(global-company-mode -1)
(load! "custom.el")