-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathearly-init.el
90 lines (66 loc) · 2.41 KB
/
early-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
;; 优化 Emacs 的启动速度
(setq gc-cons-threshold most-positive-fixnum)
(setq gc-cons-percentage 0.6)
(add-hook 'after-init-hook #'(lambda () (setq gc-cons-threshold 200000000))) ; 200 MB
;; 设置 LSP_MODE 使用 plist 进行反序列化
(setenv "LSP_USE_PLISTS" "true")
(setq lsp-use-plists t)
;; 操作系统相关变量
(defvar cabins--os-win (memq system-type '(ms-dos windows-nt cygwin)))
(defvar cabins--os-mac (eq system-type 'darwin))
;; 隐藏菜单栏
(menu-bar-mode 0)
;; 开启 TCP 连接到 Server
(setq server-use-tcp t)
;; 直接打开软链接地址的文件,而不是打开原始文件的地址
(setq vc-follow-symlinks nil)
;; 设置自动加载已修改文件
(global-auto-revert-mode t)
;; 设置弹窗窗口出现纵向分隔的极限值:这个值能在 Mac 正常分辨率下仍然以上下的方式分隔弹出窗口
(setq split-width-threshold 1800)
;; 高亮当前行
(global-hl-line-mode t)
;; 编码设置
(prefer-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
;; Always load newest byte code
(setq load-prefer-newer t)
;; 设置 Mac 上的缺省按键映射
(setq mac-option-modifier 'super)
(setq mac-command-modifier 'meta)
;; 设置缩进使用空格而非 Tab,同时设置 Tab 宽度是 4 个空格
(setq-default indent-tabs-mode nil)
(setq-default tab-width 4)
;; 设置自动备份
(setq auto-save-default t)
;; 设置 yes 和 no 的输入使用简写
(defalias 'yes-or-no-p 'y-or-n-p)
;; 备份设置
(setq backup-by-copying t ; 自动备份
backup-directory-alist '(("." . "~/.em_backup")) ; 自动备份在目录"~/.em_backup"下
delete-old-versions t ; 自动删除旧的备份文件
kept-new-versions 3 ; 保留最近的3个备份文件
kept-old-versions 1 ; 保留最早的1个备份文件
version-control t) ; 多次备份
;; 显示光标所在列数
(column-number-mode 1)
;; 设置行号根据右侧对齐
(setq display-line-numbers-width-start t)
;; 隐藏工具栏
(when (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
;; Newline at end of file
(setq require-final-newline t)
;;关闭启动画面
(setq inhibit-startup-message t)
;; 隐藏滚动条
(when (fboundp 'scroll-bar-mode)
(scroll-bar-mode -1))
;; 设置选中时编辑直接删除选中值
(delete-selection-mode t)
;; 高亮匹配括号
(show-paren-mode t)
;; 设置光标样式
(setq-default cursor-type 'box)