blob: fccabbc2ea00d376537104e89e284001c0e410a4 (
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
231
232
233
234
235
236
237
238
239
240
241
|
;;; -*- lexical-binding: t -*-
(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.
'(bongo-custom-backend-matchers '((vlc (local-file) . "opus")))
'(bongo-enabled-backends '(vlc))
'(bongo-insert-intermediate-headers t)
'(custom-enabled-themes '(tsdh-dark))
'(display-time-24hr-format t)
'(display-time-day-and-date t)
'(display-time-mode nil)
'(inhibit-startup-screen t)
'(menu-bar-mode nil)
'(package-archives
'(("gnu" . "https://elpa.gnu.org/packages/")
("nongnu" . "https://elpa.nongnu.org/nongnu/")
("melpa" . "https://melpa.org/packages/")))
'(package-selected-packages
'(moe-theme ample-theme monokai-theme zenburn-theme edit-server simple-httpd melancholy-theme volume selectrum origami imenu-anywhere hydra highlight gdscript-mode free-keys folding fold-this f dumb-jump bongo))
'(scroll-bar-mode nil)
'(tool-bar-mode nil)
'(transient-mark-mode nil))
(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.
'(header-line ((t (:inverse-video t :box (:line-width (1 . -1) :color "red" :style released-button))))))
;; stuff I will always want
(electric-pair-mode 1)
(global-hl-line-mode 1)
;; common hooks
(add-hook 'text-mode-hook (lambda () (flyspell-mode 1)))
(add-hook 'prog-mode-hook (lambda () (hs-minor-mode 1)))
;; transparancy
(add-to-list 'default-frame-alist '(alpha-background . 90)) ; For all new frames
(defun toggle-frame-transparency ()
"Toggle transparency."
(interactive)
(let ((alpha-transparency 90))
(if (eq alpha-transparency (frame-parameter nil 'alpha-background))
(set-frame-parameter nil 'alpha-background 100)
(set-frame-parameter nil 'alpha-background alpha-transparency))))
;; mode line stuff
(require 'battery)
(defun with-face (str &rest face-plist)
(propertize str 'face face-plist))
(defun make-mode-line-info-string ()
"generates the mode line string that contains all the info to the right"
(concat (format-time-string "%a, %b %+4Y-%0m-%0d ")
(with-face (format-time-string "%R ")
:weight 'bold)
(with-face (format "<%03.2f> " (car (load-average 1)))
:foreground "#da70d6")
(with-face (let* ((mi (memory-info))
(tm (float (car mi)))
(fm (float (car (cdr mi))))
(ts (float (car (cdr (cdr mi)))))
(fs (float (car (cdr (cdr (cdr mi)))))))
(format "{%.2f %.2f} " (- 1 (/ fm tm)) (- 1 (/ fs ts))))
:foreground "#00ced1")
(with-face (battery-format "[%b%p%%%%] " (and battery-status-function (funcall battery-status-function)))
:weight 'bold)))
(setq global-mode-string '("" (:eval (make-mode-line-info-string))))
;; custom func keybinds
(global-unset-key (kbd "M-w"))
(global-set-key (kbd "M-w") 'copy-region-as-kill) ;;make copying not flash cursor
(defun zap-whitespace ()
"zaps the whitespace around the point in both directions"
(interactive)
(push-mark)
(skip-chars-backward " \t\n")
(push-mark)
(skip-chars-forward " \t\n")
(delete-region (mark) (point))
(pop-mark)
(goto-char (mark))
(pop-mark))
(global-unset-key (kbd "M-z"))
(global-set-key (kbd "M-z") 'zap-whitespace)
(defun wrap-sexp (&optional arg)
"Wraps the following sexp in a pair of parens and places inside the new pair, with prefix arg do the same backwards, pushing the mark"
(interactive "P")
(message "%s" arg)
(if arg
(progn
(push-mark)
(insert-pair -1 ?\( ?\)))
(insert-pair 1 ?\( ?\))))
(global-set-key (kbd "C-M-z") 'wrap-sexp)
;;move buffers between windows in a convient way
(defun swap-buffer ()
"Cycles the assignment of buffers to windows"
(interactive)
(cond ((one-window-p) (display-buffer (other-buffer)))
((let* ((buffer-a (current-buffer))
(window-b (cadr (window-list)))
(buffer-b (window-buffer window-b)))
(set-window-buffer window-b buffer-a)
(switch-to-buffer buffer-b)
(other-window 1)))))
;;replace shrink window
(global-unset-key (kbd "C-x -"))
(global-set-key (kbd "C-x -") 'swap-buffer)
;; quick window switching
(global-set-key (kbd "M-o") 'other-window)
(global-set-key (kbd "M-W") 'switch-to-buffer)
;; save/restore window config
(setq current-saved-layout ?0)
(seq-do (lambda (number)
(let* ((string (int-to-string number))
(char (string-to-char string))
(key (kbd (concat "M-" string))))
(global-unset-key key)
(global-set-key key (lambda ()
(interactive)
(window-configuration-to-register current-saved-layout)
(unless (window-configuration-p (car (get-register char)))
(window-configuration-to-register char))
(jump-to-register char)
(setq current-saved-layout char)))))
'(0 1 2 3 4 5 6 7 8 9))
;; get me a calculator
(global-unset-key (kbd "M-c"))
(global-set-key (kbd "M-c") 'calc)
;; compilation stuff
(global-unset-key (kbd "M-n"))
(global-set-key (kbd "M-n") 'compile)
(global-unset-key (kbd "M-m"))
(global-set-key (kbd "M-m") 'recompile)
;; latex stuff
(require 'tex-mode)
(define-key latex-mode-map (kbd "C-c m") (lambda () (interactive)
(insert "\\[\n\n\\]")
(backward-char 3)))
;; region folding
(require 'fold-this)
;; folding keybinds
(defun fold-this-fold-forward (&optional arg)
(interactive "p")
(push-mark)
(forward-sexp arg)
(fold-this (mark) (point))
(pop-mark))
(defun fold-this-fold-backward (&optional arg)
(interactive "p")
(push-mark)
(backward-sexp arg)
(fold-this (point) (mark))
(pop-mark))
(define-prefix-command 'fold-map)
(global-set-key (kbd "M-F") 'fold-map)
(define-key fold-map (kbd "d") 'fold-this)
;; (global-set-key (kbd "M-F d") 'fold-this)
(define-key fold-map (kbd "e") 'fold-this-unfold-at-point)
;; (global-set-key (kbd "M-F e") 'fold-this-unfold-at-point)
(define-key fold-map (kbd "t") 'hs-toggle-hiding)
;; (global-set-key (kbd "M-F t") 'hs-toggle-hiding)
(define-key fold-map (kbd "f") 'fold-this-fold-forward)
(define-key fold-map (kbd "b") 'fold-this-fold-backward)
;; better minibuffer complete
(selectrum-mode 1)
(savehist-mode)
(setq selectrum-display-style '(horizontal))
(setq selectrum-display-action '(display-buffer-in-side-window (side . bottom) (slot . -1)))
(use-package orderless
:ensure t
:custom
(completion-styles '(orderless basic))
(orderless-matching-styles '(orderless-literal orderless-regexp orderless-prefixes))
(orderless-skip-highlighting (lambda () selectrum-is-active))
(selectrum-highlight-candidates-function #'orderless-highlight-matches))
;; better in-buffer completion
(require 'company)
(add-hook 'prog-mode-hook (lambda ()
(company-mode 1)))
(global-unset-key (kbd "M-/"))
(global-set-key (kbd "M-/") 'company-complete)
;; exwm stuff
;;(load "~/.emacs.d/exwm-pref.el")
;; mail stuff
;; (load "~/.emacs.d/mail.el")
;; music
;; (load "~/.emacs.d/bongo.el")
;; (load "~/.emacs.d/youtube-dl.el")
;; (load "~/.emacs.d/bongo-populate.el")
;; allow using emacsclient
(server-start)
;; don't ask about killing buffers
(setq kill-buffer-query-functions (delq 'process-kill-buffer-query-function kill-buffer-query-functions))
;; allow doing webpage startup
;; (use-package edit-server
;; :ensure t
;; :commands edit-server-start
;; :init (if after-init-time
;; (edit-server-start)
;; (add-hook 'after-init-hook
;; #'(lambda() (edit-server-start))))
;; :config (setq edit-server-new-frame-alist
;; '((name . "Edit with Emacs FRAME")
;; (top . 200)
;; (left . 200)
;; (width . 80)
;; (height . 25)
;; (minibuffer . t)
;; (menu-bar-lines . t))))
;; (load-file "~/.emacs.d/async-eval.el")
(put 'dired-find-alternate-file 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'list-timers 'disabled nil)
(put 'narrow-to-region 'disabled nil)
|