-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el
129 lines (101 loc) · 4.23 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
;;; init.el --- init emacs config -*- lexical-binding: t -*-
;;; Code:
;; Produce backtraces when errors occur: can be helpful to diagnose startup issues
;;(setq debug-on-error t)
;; =============================================================================
;; define base lisp dirctory
;; =============================================================================
(defconst emacsc-lisp-directory (expand-file-name "lisp" user-emacs-directory))
(defconst emacsc-core-directory (expand-file-name "core" emacsc-lisp-directory))
(add-to-list 'load-path emacsc-lisp-directory)
(add-to-list 'load-path emacsc-core-directory)
;; =============================================================================
;; define system type
;; =============================================================================
(defconst emacsc-system-is-mac (eq system-type 'darwin))
(defconst emacsc-system-is-linux (eq system-type 'gnu/linux))
(defconst emacsc-system-is-windows (memq system-type '(cygwin windows-nt ms-dos)))
;; =============================================================================
;; Adjust garbage collection thresholds during startup, and thereafter
;; =============================================================================
(let ((normal-gc-cons-threshold (* 20 1024 1024))
(init-gc-cons-threshold (* 128 1024 1024)))
(setq gc-cons-threshold init-gc-cons-threshold)
(add-hook 'emacs-startup-hook
(lambda () (setq gc-cons-threshold normal-gc-cons-threshold))))
;; =============================================================================
;; Pre config <= emacs 29
;; =============================================================================
(cond
(emacsc-system-is-windows
(set-face-attribute
'default nil
:font (font-spec :name "-outline-Source Code Pro-bold-italic-normal-mono-*-*-*-*-c-*-iso10646-1"
:weight 'normal
:slant 'normal
:size 10.0))
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font
(frame-parameter nil 'font)
charset
(font-spec :name "-outline-微软雅黑-normal-normal-normal-sans-*-*-*-*-p-*-iso10646-1"
:weight 'normal
:slant 'normal
:size 12.0))))
(emacsc-system-is-linux
(set-face-attribute
'default nil
:font (font-spec :name "-ADBO-Source Code Pro-normal-normal-normal-*-*-*-*-*-m-0-iso10646-1"
:weight 'normal
:slant 'normal
:size 12.5))
(dolist (charset '(kana han symbol cjk-misc bopomofo))
(set-fontset-font
(frame-parameter nil 'font)
charset
(font-spec :name "-SINO-华文楷体-normal-normal-normal-*-*-*-*-*-*-0-iso10646-1"
:weight 'normal
:slant 'normal
:size 15.0)))))
;; =============================================================================
;; Bootstrap config
;; =============================================================================
(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(require 'core)
(require 'init-utils)
(require 'init-org)
(require 'init-yasnippet)
(require 'init-projectile)
(require 'init-ivy)
(require 'init-completion)
(require 'init-ledger)
(require 'init-md)
(require 'init-lsp)
(require 'init-rust)
(require 'init-python)
(require 'init-major-mode)
(require 'init-go)
(require 'init-vc)
(require 'init-treemacs)
(when (not emacsc-system-is-windows)
(require 'init-vterm))
;; (when (not emacsc-system-is-mac)
;; (require 'init-eaf))
(when emacsc-system-is-linux
(require 'init-rime))
(when (file-exists-p custom-file)
(load custom-file))
;; =============================================================================
;; cnfonts
;; =============================================================================
(use-package-straight cnfonts
:config (cnfonts-mode))
;; =============================================================================
;; start server
;; =============================================================================
(require 'server)
(setq server-socket-dir (expand-file-name "server" user-emacs-directory))
(unless (server-running-p)
(message "Starting a server...")
(server-start))
;;; init.el ends here