-
Notifications
You must be signed in to change notification settings - Fork 1
/
init.el
146 lines (130 loc) · 4.29 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
(setq package-archives '(("gnu" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
("melpa" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")
("org" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/org/")))
(setq package-check-signature nil)
;;个别包会签名验证失败
(require 'package)
;;初始化包管理器
(unless (bound-and-true-p package--initialized)
(package-initialize))
;;刷新软件源索引
(unless package-archive-contents
(package-refresh-contents))
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
;;(eval-and-compile)
(setq use-package-always-ensure t)
(setq use-package-always-defer t)
(setq use-package-always-demand nil)
(setq use-package-expand-minimally t)
(setq use-package-verbose t)
;;packages-installed
(require 'use-package)
(use-package restart-emacs)
(use-package gruvbox-theme
:init (load-theme 'gruvbox-dark-soft t))
(use-package smart-mode-line
:init
(setq sml/no-confirm-load-theme t
sml/theme 'respectful)
(sml/setup))
;;测试启动耗时
(use-package benchmark-init
:init (benchmark-init/activate)
:hook (after-init . benchmark-init/deactivate))
;;括号高亮
(use-package rainbow-delimiters)
(add-hook 'foo-mode-hook #'rainbow-delimiters-mode)
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)
;;evil-mode
(use-package evil
:init
(evil-mode 1))
;;company
(use-package company
:config
(setq company-dabbrev-code-everywhere t
company-dabbrev-code-modes t
company-dabbrev-code-other-buffers 'all
company-dabbrev-downcase nil
company-dabbrev-ignore-case t
company-dabbrev-other-buffers 'all
company-require-match nil
company-minimum-prefix-length 1
company-show-numbers t
company-tooltip-limit 20
company-idle-delay 0
company-echo-delay 0
company-tooltip-offset-display 'scrollbar
company-begin-commands '(self-insert-command))
(push '(company-semantic :with company-yasnippet) company-backends)
:hook
((after-init . global-company-mode)))
;;语法检查
(use-package flycheck
:hook (after-init . global-flycheck-mode))
(use-package neotree)
(use-package super-save)
(use-package crux
:bind (("C-a" . crux-move-beginning-of-line)
("C-c ^" . crux-top-join-line)
("C-x ," . crux-find-user-init-file)
("C-S-d" . crux-duplicate-current-line-or-region)
("C-S-k" . crux-smart-kill-line)))
(use-package ace-window
:bind
(("M-o" . 'ace-window)))
(use-package which-key
:config
(which-key-mode))
(use-package lsp-mode
:init
(setq lsp-keymap-prefix "C-c l")
:hook (
(lsp-mode . lsp-enable-which-key-integration)
(shell-mode . lsp)
(rust-mode . lsp)
(c-mode . lsp)
(c++-mode . lsp)
(go-mode . lsp))
:commands lsp)
(use-package lsp-ui :commands lsp-ui-mode)
(use-package helm-lsp :commands helm-lsp-workspace-symbol)
(use-package dap-mode)
(use-package smart-compile)
;;user-config
(menu-bar-mode -1)
(tool-bar-mode -1)
(scroll-bar-mode -1)
(setq inhibit-startup-screen t)
(setq make-backup-files nil)
(electric-pair-mode t)
;;显示行号
;;(global-linum-mode t)
(setq display-line-numbers-type 'relative)
(global-display-line-numbers-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)
(setq default-buffer-file-coding-system 'utf-8)
(setq gc-cons-threshold most-positive-fixnum)
;;keymap
(defalias 'yes-or-no-p 'y-or-n-p)
;;<C-g> quit
(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
(rust-mode go-mode smart-compile dap-mode lsp-mode ace-window ivy-posframe ivy crux super-save neotree flycheck evil use-package smart-mode-line restart-emacs rainbow-delimiters paredit highlight-parentheses gruvbox-theme benchmark-init))))
(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.
)