-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el.bak
105 lines (81 loc) · 2.54 KB
/
init.el.bak
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
(when (>= emacs-major-version 24)
(require 'package)
(package-initialize)
(setq package-archives '(("gnu" . "http://elpa.emacs-china.org/gnu/")
("melpa" . "http://elpa.emacs-china.org/melpa/"))))
;; 注意 elpa.emacs-china.org 是 Emacs China 中文社区在国内搭建的一个 ELPA 镜像
;; cl - Common Lisp Extension
(require 'cl)
;; Add Packages
(defvar my/packages '(
;; --- Auto-completion ---
company
;; --- Better Buffer ---
;; recentf
;; --- Better Editor ---
hungry-delete
swiper
counsel
smartparens
;; --- Major Mode ---
js2-mode
;; --- Minor Mode ---
nodejs-repl
exec-path-from-shell
;; --- Themes ---
monokai-theme
;; solarized-theme
) "Default packages")
(setq package-selected-packages my/packages)
(defun my/packages-installed-p ()
(loop for pkg in my/packages
when (not (package-installed-p pkg)) do (return nil)
finally (return t)))
(unless (my/packages-installed-p)
(message "%s" "Refreshing package database...")
(package-refresh-contents)
(dolist (pkg my/packages)
(when (not (package-installed-p pkg))
(package-install pkg))))
;; Find Executable Path on OS X
(when (memq window-system '(mac ns))
(exec-path-from-shell-initialize))
;; 关闭工具栏,tool-bar-mode 即为一个 Minor Mode
(tool-bar-mode -1)
;; 关闭文件滑动控件
(scroll-bar-mode -1)
;; 显示行号
(global-linum-mode 1)
;; 更改光标的样式(不能生效,解决方案见第二集)
(setq-default cursor-type 'bar)
;; 关闭启动帮助画面
(setq inhibit-splash-screen 1)
;; 关闭缩进 (第二天中被去除)
;; (electric-indent-mode -1)
;; 更改显示字体大小 16pt
;; http://stackoverflow.com/questions/294664/how-to-set-the-font-size-in-emacs
(set-face-attribute 'default nil :height 160)
;; 快速打开配置文件
(defun open-init-file()
(interactive)
(find-file "~/.emacs.d/init.el"))
;; 这一行代码,将函数 open-init-file 绑定到 <f2> 键上
(global-set-key (kbd "<f2>") 'open-init-file)
;; 开启全局company补全
(global-company-mode 1)
(setq make-backup-files nil)
;; 打开最近的文件
(require 'recentf)
(recentf-mode 1)
(setq recentf-max-menu-item 10)
;; 关闭package验证
;; (setq package-check-signature nil)
;; 替换选择的内容
(delete-selection-mode 1)
;; 括号匹配
(add-hook 'emacs-lisp-mode-hook 'show-paren-mode)
;; 高亮当前行
(global-hl-line-mode 1)
;; 主题
(add-to-list 'my/packages 'monokai-theme)
(load-theme 'monokai 1)