-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
240 lines (177 loc) · 6.64 KB
/
init.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
;;; -*- lexical-binding: t -*-
;; Author: yangxue <[email protected]>
;; Created: 2024-07-05 11:18:22
;; License: GPLv3
;;; Commentary:
;;
;;; Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Basic Settings
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defconst IS-MAC (eq system-type 'darwin))
(defconst IS-WIN (eq system-type 'windows-nt))
(set-language-environment "UTF-8")
(setopt debug-on-error t)
(setopt system-time-locale "C")
(setopt custom-file "~/.emacs.d/custom.el")
(setopt word-wrap t)
(setopt word-wrap-by-category t)
(setopt require-final-newline t)
(setopt sentence-end-double-space nil)
(setopt use-short-answers t)
(setopt use-dialog-box nil)
(setopt inhibit-splash-screen t)
(setopt inhibit-startup-message t)
(setopt initial-scratch-message nil)
(setopt bidi-inhibit-bpa t)
(setopt bidi-paragraph-direction 'left-to-right)
(setopt inhibit-compacting-font-caches t)
(setopt read-process-output-max (* 1024 1024))
(setopt reb-re-syntax 'string)
(setopt mouse-wheel-tilt-scroll t)
(setopt tab-always-indent 'complete)
(setopt set-mark-command-repeat-pop t)
(setopt find-file-visit-truename t)
(setopt delete-by-moving-to-trash t)
(setopt recentf-max-saved-items 100)
(setopt auto-revert-avoid-polling t)
(setopt auto-save-visited-interval 10)
(setopt global-auto-revert-non-file-buffers t)
(setopt backward-delete-char-untabify-method 'hungry)
(setopt use-package-always-ensure t)
(setopt use-package-compute-statistics t)
(setopt epg-pinentry-mode 'loopback)
(setopt epa-file-encrypt-to user-mail-address)
(setopt split-width-threshold 120)
(setopt switch-to-prev-buffer-skip 'this)
(setopt switch-to-buffer-obey-display-actions t)
(setopt enable-recursive-minibuffers t)
(setopt completion-auto-select 'second-tab)
(setopt read-extended-command-predicate #'command-completion-default-include-p)
(setopt user-mail-address "[email protected]")
(setopt smtpmail-smtp-server "smtp.qq.com")
(setopt gnus-select-method '(nnimap "foxmail.cs" (nnimap-address "imap.qq.com")))
(setopt dired-dwim-target t)
(setopt dired-mouse-drag-files t)
(setopt dired-kill-when-opening-new-dired-buffer t)
(setopt calendar-date-style 'iso)
(setopt dictionary-server "dict.org")
(setopt browse-url-browser-function #'eww-browse-url)
(setopt tab-bar-show 1)
(setopt tab-bar-close-button-show nil)
(setopt tab-line-close-button-show 'selected)
(add-hook 'after-init-hook (lambda ()
(load custom-file t t)
(setopt debug-on-error nil)))
(add-hook 'text-mode-hook #'abbrev-mode)
(add-hook 'text-mode-hook #'visual-line-mode)
(add-hook 'text-mode-hook #'variable-pitch-mode)
(add-hook 'text-mode-hook (lambda () (setq line-spacing 0.2)))
(add-hook 'before-save-hook #'whitespace-cleanup)
(add-hook 'eww-after-render-hook (lambda ()
(eww-readable)
(setq line-spacing 0.2)
(variable-pitch-mode +1)))
(windmove-default-keybindings 'control)
(windmove-swap-states-default-keybindings '(control shift))
(with-eval-after-load 'esh-module
(add-to-list 'eshell-modules-list 'eshell-rebind))
(add-hook 'eshell-mode-hook (lambda ()
(eshell-hist-mode +1)
(keymap-local-set "C-l" #'eshell/clear)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Global Mirror Mode
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(repeat-mode +1)
(winner-mode +1)
(save-place-mode +1)
(auto-save-visited-mode +1)
(global-auto-revert-mode +1)
(cua-selection-mode +1)
(window-divider-mode +1)
(global-hl-line-mode +1)
(pixel-scroll-precision-mode +1)
(add-hook 'after-init-hook #'recentf-mode)
(add-hook 'after-init-hook #'savehist-mode)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Ui
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setopt nobreak-char-display nil)
(setopt mode-line-end-spaces '(:eval (if (display-graphic-p) " " "-%-")))
(set-face-attribute 'fixed-pitch nil :family "Iosevka")
(dolist (charset '(han cjk-misc))
(set-fontset-font t charset (font-spec :family "LXGW WenKai Mono")))
(setopt modus-themes-mixed-fonts t)
(setopt modus-themes-variable-pitch-ui t)
(setopt modus-themes-org-blocks 'tinted-background)
(setopt modus-themes-headings '((0 . (1.3))
(1 . (1.2))
(2 . (semibold 1.1))
(t . (semibold 1.05))))
(load-theme 'modus-operandi t)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Keybindings
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(keymap-global-unset "C-z")
(keymap-global-set "C-/" #'undo-only)
(keymap-global-set "M-/" #'hippie-expand)
(keymap-global-set "C-M-r" #'raise-sexp)
(keymap-global-set "C-c a" #'org-agenda)
(keymap-global-set "C-c c" #'org-capture)
(keymap-global-set "C-c l" #'org-store-link)
(keymap-global-set "C-c d" #'duplicate-dwim)
(keymap-global-set "C-c s" #'scratch-buffer)
(keymap-global-set "C-c 3" #'follow-delete-other-windows-and-split)
(keymap-global-set "M-s d" #'dictionary-lookup-definition)
(keymap-global-set "M-s M-d" #'dictionary-search)
(keymap-global-set "C-x C-b" #'ibuffer)
(keymap-substitute global-map #'zap-to-char #'zap-up-to-char)
(keymap-substitute global-map #'upcase-word #'upcase-dwim)
(keymap-substitute global-map #'downcase-word #'downcase-dwim)
(keymap-substitute global-map #'capitalize-word #'capitalize-dwim)
(with-eval-after-load 'isearch
(keymap-substitute isearch-mode-map #'isearch-delete-char #'isearch-del-char))
(defalias 'run-el #'ielm)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; OS Specific
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(when IS-WIN
(setq w32-apps-modifier 'hyper)
(setq w32-lwindow-modifier 'super)
(w32-register-hot-key [s-.]))
(when IS-MAC
(let ((paths
(with-temp-buffer
(call-process-shell-command "cat /etc/paths /etc/paths.d/*" nil t)
(split-string (buffer-string)))))
(setenv "PATH" (mapconcat #'identity paths ":"))
(setq exec-path (append paths (list exec-directory)))))
(setenv "HTTP_PROXY" "http://localhost:7890")
(setenv "HTTPS_PROXY" "http://localhost:7890")
(require 'server)
(or (server-running-p) (server-start))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;
;;; Core Extras
;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(with-eval-after-load 'package
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t))
(add-to-list 'load-path "~/.emacs.d/extras")
(require 'init-util)
(require 'init-base)
(require 'init-org+)
(require 'init-dev+)
(require 'init-misc)
(require 'init-blog)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;