-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.el
296 lines (234 loc) · 10.3 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
;;; $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 "Giulio Centorame"
user-mail-address "giulio.centorame@outlook.it")
;; 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 "Source Code Pro" :size 20 :weight 'regular)
doom-variable-pitch-font (font-spec :family "Source Code Pro" :size 20 'weight 'regular))
;; Some cool fonts: FiraCode Nerd Font Complete Mono,
;; 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)
;; 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 "~/Dropbox/org/")
;; 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 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.
;; Basic settings ;;
;;;;;;;;;;;;;;;;;;;;
;; GPG settings
(setq auth-sources '("~/.authinfo.gpg")
auth-source-cache-expiry nil) ; default: 7200 (2h)
;; I nicked the following from https://github.com/sunnyhasija/DOOMEmacs
;; Some more sensible than others, they are just up to preferences.
(setq-default
delete-by-moving-to-trash t ; Delete files to trash
tab-width 4 ; Set width for tabs
uniquify-buffer-name-style 'forward ; 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
(setq 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
auto-save-default t ; Nobody likes to loose work, I certainly don't
inhibit-compacting-font-caches t ; When there are lots of glyphs, keep them in memory
truncate-string-ellipsis "…") ; Unicode ellispis are nicer than "...", and also save /precious/ space
(delete-selection-mode 1) ; Replace selection when inserting text
(display-time-mode 1) ; Enable time in the mode-line
;; Battery status display
(unless (equal "Battery status not avalible"
(battery))
(display-battery-mode 1)) ; On laptops it's nice to know how much power you have
(global-subword-mode 1) ; Iterate through CamelCase words
;; Fullscreen on startup
(if (eq initial-window-system 'x) ; if started by emacs command or desktop file
(toggle-frame-maximized)
(toggle-frame-fullscreen))
;; Windows behaviour
; Pick what to see in the frame when you split a window
(setq evil-vsplit-window-right t
evil-split-window-below t)
(defadvice! prompt-for-buffer (&rest _)
:after '(evil-window-split evil-window-vsplit)
(+ivy/switch-buffer))
(setq +ivy-buffer-preview t)
;; Windows rotation
(map! :map evil-window-map
"SPC" #'rotate-layout
"<left>" #'evil-window-left
"<down>" #'evil-window-down
"<up>" #'evil-window-up
"<right>" #'evil-window-right
;; Swapping windows
"C-<left>" #'+evil/window-move-left
"C-<down>" #'+evil/window-move-down
"C-<up>" #'+evil/window-move-up
"C-<right>" #'+evil/window-move-right)
;; Projectile ;;
;;;;;;;;;;;;;;;;
;; Projectile default search path
(setq projectile-project-search-path '("~/Repositories/"))
;; ORG-MODE ;;
;;;;;;;;;;;;;;
;; ox-pandoc
; Sensible options to convert org files
; from https://github.com/sunnyhasija/DOOMEmacs
;; (use-package! ox-pandoc
;; :after org)
;; ;; default options for all output formats
;; (setq org-pandoc-options '((standalone . _)))
;; ;; cancel above settings only for 'docx' format
;; (setq org-pandoc-options-for-docx '((standalone . nil)))
;; ;; special settings for beamer-pdf and latex-pdf exporters
;; (setq org-pandoc-options-for-beamer-pdf '((pdf-engine . "xelatex")))
;; (setq org-pandoc-options-for-latex-pdf '((pdf-engine . "pdflatex")))
;; ;; special extensions for markdown_github output
;; (setq org-pandoc-format-extensions '(markdown_github+pipe_tables+raw_html))
;; ;; Load .md exporter for org
;; (eval-after-load "org"
;; '(require 'ox-md nil t))
;; Use org-super-agenda
; from https://github.com/sunnyhasija/DOOMEmacs
;; LaTeX ;;
;;;;;;;;;;;
;; LaTeX previews using pdf-tools
;;(latex-preview-pane-enable)
(setq +latex-viewers '(pdf-tools))
;; cheat.sh ;;
;;;;;;;;;;;;;;
;;
;; Taken from https://www.reddit.com/r/emacs/comments/6ddr7p/snippet_search_cheatsh_using_ivy/
;; FIXME this broke :()
;; (defun ejmr-search-cheat-sh ()
;; "Search `http://cheat.sh/' for help on commands and code."
;; (interactive)
;; (ivy-read "Command or Topic: "
;; (process-lines "curl" "--silent" "http://cheat.sh/:list?T&q")
;; :require-match t
;; :sort t
;; :history 'ejmr-search-cheat-sh
;; :action (lambda (input)
;; (eww-browse-url (concat "http://cheat.sh/" input "?T&q")))
;; :caller 'ejmr-search-cheat-sh))
;; Bindings ;;
;;;;;;;;;;;;;;
;; MISC:
;; Ugly mapping, but that's temporary.
;; TODO a better config management, possibly modular (see MatthewZMD/.emacs.d)
;; (map! :leader
;; (:prefix-map ("z" . "custom")
;; :desc "cheat.sh" "c" #'ejmr-search-cheat-sh
;; ;; :desc "Elfeed" "e" #'elfeed
;; )
;; )
;; Wakatime ;;
;;;;;;;;;;;;;;
(use-package! wakatime-mode)
;; Remember to set `wakatime-api-key' and `wakatime-cli-path'
;; OR to keep your config.el clean of personal information, run on CLI
;; `wakatime --config-write api_key [WAKATIME_API_KEY]'
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(package-selected-packages (quote (wakatime-mode))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
)
;; info-colors ;;
;;;;;;;;;;;;;;;;;
;; makes the documentation more readable
(use-package! info-colors
:commands (info-colors-fontify-node))
(add-hook! 'Info-selection-hook 'info-colors-fontify-node)
(add-hook! 'Info-mode-hook #'mixed-pitch-mode)
;; pdf-tools ;;
;;;;;;;;;;;;;;;
(after! pdf-view
;; open pdfs scaled to fit page
(setq-default pdf-view-display-size 'fit-width)
;; automatically annotate highlights
(setq pdf-annot-activate-created-annotations t
pdf-view-resize-factor 1.1)
;; faster motion
(map!
:map pdf-view-mode-map
:n "g g" #'pdf-view-first-page
:n "G" #'pdf-view-last-page
;; :n "N" #'pdf-view-next-page-command
;; :n "E" #'pdf-view-previous-page-command
;; :n "e" #'evil-collection-pdf-view-previous-line-or-previous-page
;; :n "n" #'evil-collection-pdf-view-next-line-or-next-page
;; :localleader
;; (:prefix "o"
;; (:prefix "n"
;; :desc "Insert" "i" 'org-noter-insert-note
;; ))
))
;; Path configuration for citar ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(after! citar
(setq! citar-bibliography '("~/Repositories/notes/library.bib") ; path to .bib file
citar-library-paths ; path to pdfs
citar-notes-paths) ; path to either .org file (single note file) or folder (multiple note files)
)
(after! org-noter
(setq org-noter-notes-search-path '("~/Repositories/notes/library.bib"))
)
;; Disable auto RDM ;;
;;;;;;;;;;;;;;;;;;;;;;
; Do not automatically try to run rdm
(remove-hook! 'c-mode-common-hook #'+cc|init-rtags)
(connection-local-set-profile-variables 'bc4-config
'(magit-remote-git-executable . "/mnt/storage/software/tools/git-2.18.0/bin"))
(connection-local-set-profiles '(:application 'tramp :protocol "ssh" :machine "bc4") 'bc4-config)
(elcord-mode)
;;;;;;;;;;;;;;;;;;;;
;; Enables wt for all buffers
;; Has to stay at the end of file
(global-wakatime-mode)
;; accept completion from copilot and fallback to company
(use-package! copilot
:hook (prog-mode . copilot-mode)
:bind (("C-TAB" . 'copilot-accept-completion-by-word)
("C-<tab>" . 'copilot-accept-completion-by-word)
:map copilot-completion-map
("<tab>" . 'copilot-accept-completion)
("TAB" . 'copilot-accept-completion)))
;; Hotfix for the rust debugger
(defadvice! fix-lsp-rust-analyzer-debug (&rest _)
:before #'lsp-rust-analyzer-debug
(require 'dap-cpptools))
(setq dap-cpptools-extension-version "1.12.1")