-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.el
132 lines (116 loc) · 4.98 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
;; Setup load-path, autoloads and your lisp system
;; Not needed if you install SLIME via MELPA
(global-unset-key (kbd "C-j"))
(setq inferior-lisp-program "sbcl")
;;use package to manage plugin
(eval-when-compile
(require 'use-package))
;cider - a clojure repl env
(use-package cider
:ensure t)
(use-package magit
:bind (("C-x g" . magit)))
(use-package marginalia
:ensure t
:init (marginalia-mode)
:bind (:map minibuffer-local-map
("M-A" . marginalia-cycle)))
(use-package counsel
:ensure t)
(use-package which-key
:ensure t
:init (which-key-mode))
(use-package avy
:ensure t
:bind
(("C-j C-SPC" . avy-goto-char-timer)))
(use-package ace-window
:ensure t
:bind (("C-x o" . 'ace-window)))
(use-package ivy
:ensure t
:init
(ivy-mode 1)
(counsel-mode 1)
:config
(setq ivy-use-virtual-buffers t)
(setq search-default-mode #'char-fold-to-regexp)
(setq ivy-count-format "(%d/%d) ")
:bind
(("C-s" . 'swiper)
("C-x b" . 'ivy-switch-buffer)
("C-c v" . 'ivy-push-view)
("C-c s" . 'ivy-switch-view)
("C-c V" . 'ivy-pop-view)
("C-x C-@" . 'counsel-mark-ring); 在某些终端上 C-x C-SPC 会被映射为 C-x C-@,比如在 macOS 上,所以要手动设置
("C-x C-SPC" . 'counsel-mark-ring)
:map minibuffer-local-map
("C-r" . counsel-minibuffer-history)))
;;use package ends
;;settings from Steve Purcell
(let ((minver "25.1"))
(when (version< emacs-version minver)
(error "Your Emacs is to old -- this config requires v%s or higher" minver)))
(when (version< emacs-version "26.1")
(message "Your Emacs is old, and some functionality in this config will be disabled. Please upgrade if possible."))
(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory)) ; 设定源码加载路径
(defconst *spell-check-support-enabled* nil) ;; Enable with t if you prefer
(defconst *is-a-mac* (eq system-type 'darwin))
(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))))
;; Steve Purcell settings ends here
;;org mode settings starts
(setq org-special-ctrl-a/e t)
(setq org-special-ctrl-k t)
;;org mode settings ends
;; some simple settings start
(setq magit-view-git-manual-method 'man) ; set git man
(setq confirm-kill-emacs #'yes-or-no-p) ; 在关闭 Emacs 前询问是否确认关闭,防止误触
(electric-pair-mode t) ; 自动补全括号
(add-hook 'prog-mode-hook #'show-paren-mode) ; 编程模式下,光标在括号上时高亮另一个括号
(column-number-mode t) ; 在 Mode line 上显示列号
(global-auto-revert-mode t) ; 当另一程序修改了文件时,让 Emacs 及时刷新 Buffer
(delete-selection-mode t) ; 选中文本后输入文本会替换文本(更符合我们习惯了的其它编辑器的逻辑)
(setq inhibit-startup-message t) ; 关闭启动 Emacs 时的欢迎界面
(setq make-backup-files nil) ; 关闭文件自动备份
(add-hook 'prog-mode-hook #'hs-minor-mode) ; 编程模式下,可以折叠代码块
(global-display-line-numbers-mode 1) ; 在 Window 显示行号
(tool-bar-mode -1) ;关闭tool bar
(when (display-graphic-p) (toggle-scroll-bar -1))
(setq inferior-lisp-program "sbcl")
(savehist-mode 1) ; (可选)打开 Buffer 历史记录保存
(setq display-line-numbers-type 'relative) ; (可选)显示相对行号
(add-to-list 'default-frame-alist '(width . 90)) ; (可选)设定启动图形界面时的初始 Frame 宽度(字符数)
(add-to-list 'default-frame-alist '(height . 55)) ; (可选)设定启动图形界面时的初始 Frame 高度(字符数)~
;;org mode settings starts
(global-set-key (kbd "C-c l") #'org-store-link)
(global-set-key (kbd "C-c a") #'org-ageda)
(global-set-key (kbd "C-c c") #'org-capture)
;;org mode settings ends
;; some simple settings ends
(add-to-list 'load-path "/Users/song.lin/emacs/slime")
(require 'slime-autoloads)
(setq mac-option-modifier 'meta)
;; package.el 相關設定
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
(add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/") t)
(package-initialize)
(provide 'init)
;;; init.el ends here
(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
'(cider magit slime marginalia which-key use-package undo-tree counsel ace-window)))
(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.
)