-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.el~
86 lines (74 loc) · 3.61 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
;; Setup load-path, autoloads and your lisp system
;; Not needed if you install SLIME via MELPA
;;use package to manage plugin
(eval-when-compile
(require 'use-package))
(use-package counsel
:ensure t)
(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
;; some simple settings start
(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))
(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 高度(字符数)~
;; some simple settings ends
(add-to-list 'load-path "/Users/song.lin/emacs/slime")
(require 'slime-autoloads)
(setq inferior-lisp-program "/opt/sbcl/bin/sbcl")
(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