-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy path.emacs
172 lines (139 loc) · 4.44 KB
/
.emacs
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
(require 'package)
(unless package--initialized (package-initialize))
(setq package-check-signature nil)
;;; If you live in China, (setq live-in-china? t)
(setq live-in-china? nil)
(if live-in-china?
(setq package-archives ;;
'(("gnu-tuna" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/gnu/")
("org-tuna" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/org/")
("melpa-tuna" . "http://mirrors.tuna.tsinghua.edu.cn/elpa/melpa/")))
(setq package-archives ;;
'(("gnu" . "https://elpa.gnu.org/packages/")
("melpa" . "https://melpa.org/packages/")
("org" . "http://orgmode.org/elpa/"))))
;;; `package-download'
(defun package-download (pkg)
(when (not (package-installed-p pkg))
(progn (unless package-archive-contents (package-refresh-contents))
(package-install pkg))))
;;; `y-or-n-p'
(fset 'yes-or-no-p 'y-or-n-p)
;;; `open-file' (don't in new frame)
(setq ns-pop-up-frames nil)
;;; when file modify with other program: auto update buffer
(global-auto-revert-mode 1)
(setq view-read-only t)
;;; replace selected context
(delete-selection-mode t)
;;; set word wrap
(global-visual-line-mode t)
;;; set line space(pixel)
(setq line-spacing 2)
;;; empty line with file
(setq require-final-newline t)
;;; clipboard X clipboard
(setq select-enable-clipboard t)
(setq x-select-enable-clipboard t)
;;; kill process buffer without confirmation?
(setq kill-buffer-query-functions ;
(delq 'process-kill-buffer-query-function kill-buffer-query-functions))
;;; file time stamp
(setq time-stamp-active t)
(setq time-stamp-warn-inactive t)
;;; max delete history (undo)
(setq kill-ring-max 200)
;;; i don't make backup file
(setq make-backup-files nil)
;;; auto save
(auto-save-mode 0)
;;; don't create #filename# temp file
(setq auto-save-default nil)
;;; delete file to:Recycle Bin (emacs24)
(setq delete-by-moving-to-trash t)
;;; display line numbers
(if (version<= "26.0.50" emacs-version )
(progn
(require 'display-line-numbers)
(global-display-line-numbers-mode 1))
(progn
(setq linum-mode t)
(setq linum-format "%4d")
(global-linum-mode 1)))
;;; display column number
(setq column-number-mode t)
;;; `whitespace' settings
(require 'whitespace)
(setq whitespace-style ;;
'(face spaces tabs newline space-mark tab-mark newline-mark trailing))
;; Make whitespace-mode and whitespace-newline-mode
;; use "¶" for end of line char and "▷" for tab.
(setq whitespace-display-mappings
;; all numbers are unicode codepoint in decimal. e.g. (insert-char 182 1)
;; SPACE 32 「 」, 183 MIDDLE DOT 「·」, 46 FULL STOP 「.」
'((space-mark 32 [183]
[46])
(newline-mark 10 [182 10])
(tab-mark 9 [9655 9]
[92 9])))
;;; `editorconfig' settings
(package-download 'editorconfig)
(require 'editorconfig)
;;; `theme' settings
(package-download 'solarized-theme)
;; (load-theme 'solarized-light t)
(load-theme 'solarized-gruvbox-dark t)
;;; `company' settings
(package-download 'company)
(require 'company)
(package-download 'company-ctags)
(require 'company-ctags)
(with-eval-after-load 'company (company-ctags-auto-setup))
;;; `helm' settings
(package-download 'helm)
(package-download 'helm-xref)
(package-download 'helm-company)
(require 'helm)
(helm-mode 1)
(helm-autoresize-mode 1)
(require 'helm-company)
(require 'helm-xref)
;;; `fci' settings
(package-download 'fill-column-indicator)
(require 'fill-column-indicator)
(setq fci-rule-column 80)
(setq fci-handle-truncate-lines nil)
(setq fci-rule-width 1)
(setq fci-rule-color "grey30")
;;; `hl-todo' settings
(package-download 'hl-todo)
(require 'hl-todo)
(setq hl-todo-keyword-faces ;;
'(("TODO" . "green")
("FIXME" . "yellow")
("DEBUG" . "DarkCyan")
("GOTCHA" . "red")
("STUB" . "DarkGreen")))
(define-key hl-todo-mode-map (kbd "C-c p") #'hl-todo-previous)
(define-key hl-todo-mode-map (kbd "C-c n") #'hl-todo-next)
(define-key hl-todo-mode-map (kbd "C-c o") #'hl-todo-occur)
;;; `nyan-mode'
(package-download 'nyan-mode)
(if (display-graphic-p)
(progn
(require 'nyan-mode)
(nyan-start-animation)
(nyan-mode 1)))
;;; `ponylang' settings
(package-download 'ponylang-mode)
(require 'ponylang-mode)
(setq ponylang-use-ctags t)
(setq ponylang-format-on-save t)
(define-key ponylang-mode-map (kbd "<f6>") #'ponylang-menu)
(define-key ponylang-mode-map (kbd "C-c C-f") #'ponylang-format-buffer)
(add-hook 'ponylang-mode-hook ;;
#'(lambda ()
(whitespace-mode 1)
(editorconfig-mode 1)
(hl-todo-mode 1)
(fci-mode 1)))