-
Notifications
You must be signed in to change notification settings - Fork 4.9k
/
Copy pathpackages.el
239 lines (223 loc) · 9.06 KB
/
packages.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
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
;;; packages.el --- Spacemacs Editing Visual Layer packages File
;;
;; Copyright (c) 2012-2022 Sylvain Benner & Contributors
;;
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;; Code:
(defconst spacemacs-editing-visual-packages
'(
column-enforce-mode
(evil-terminal-cursor-changer :toggle (configuration-layer/package-used-p 'evil))
(hide-comnt :location (recipe :fetcher github :repo "emacsmirror/hide-comnt"))
highlight-indentation
highlight-numbers
highlight-parentheses
indent-guide
rainbow-delimiters
(term-cursor :location (recipe :fetcher github :repo "h0d/term-cursor.el")
:toggle (not (configuration-layer/package-used-p 'evil)))
volatile-highlights
writeroom-mode))
(defun spacemacs-editing-visual/init-column-enforce-mode ()
(use-package column-enforce-mode
:init
(progn
(spacemacs|add-toggle highlight-long-lines
:status column-enforce-mode
:prefix columns
:on (column-enforce-n (or columns column-enforce-column))
:on-message (format "long-lines enabled for %s columns."
(or columns column-enforce-column))
:off (column-enforce-mode -1)
:off-message (format "long-lines disabled for %s columns."
(or columns column-enforce-column))
:documentation "Highlight the characters past the 80th column."
:evil-leader "t8")
(spacemacs|add-toggle highlight-long-lines-globally
:mode global-column-enforce-mode
:documentation "Globally highlight the characters past the 80th column."
:evil-leader "t C-8"))
:spacediminish ("⑧" "8")))
(defun spacemacs-editing-visual/init-evil-terminal-cursor-changer ()
(use-package evil-terminal-cursor-changer
:if (not (display-graphic-p))
:after evil
:defer t
:init (evil-terminal-cursor-changer-activate)))
(defun spacemacs-editing-visual/init-hide-comnt ()
(use-package hide-comnt
:commands hide/show-comments-toggle
:init
(progn
(advice-add 'hide/show-comments
:after (lambda (&optional hide/show start end)
(pcase hide/show
('hide (message "Hide comments enabled."))
('show (message "Hide comments disabled.")))))
(spacemacs/set-leader-keys "ch" 'hide/show-comments-toggle))))
(defun spacemacs-editing-visual/init-highlight-indentation ()
(use-package highlight-indentation
:defer t
:init
(progn
(spacemacs|add-toggle highlight-indentation
:mode highlight-indentation-mode
:documentation "Highlight indentation levels."
:evil-leader "thi")
(spacemacs|add-toggle highlight-indentation-current-column
:mode highlight-indentation-current-column-mode
:documentation "Highlight indentation level at point."
:evil-leader "thc"))
:spacediminish ((" ⓗi" " hi")
(highlight-indentation-current-column-mode " ⓗc" " hc"))))
(defun spacemacs-editing-visual/init-highlight-numbers ()
(use-package highlight-numbers
:defer t
:init
(progn
(spacemacs|add-toggle highlight-numbers
:mode highlight-numbers-mode
:documentation "Highlight numeric literals."
:evil-leader "thn")
(add-hook 'prog-mode-hook 'highlight-numbers-mode)
(add-hook 'asm-mode-hook (lambda () (highlight-numbers-mode -1))))))
(defun spacemacs-editing-visual/init-highlight-parentheses ()
(use-package highlight-parentheses
:defer t
:custom
(highlight-parentheses-delay 0.2)
(highlight-parentheses-colors '("Springgreen3"
"IndianRed1"
"IndianRed3"
"IndianRed4"))
:custom-face (highlight-parentheses-highlight ((nil (:weight ultra-bold))))
:commands highlight-parentheses-minibuffer-setup
:init
(spacemacs|add-toggle highlight-parentheses
:mode highlight-parentheses-mode
:documentation "Highlight surrounding parentheses."
:evil-leader "thp")
(spacemacs|add-toggle highlight-parentheses-globally
:mode global-highlight-parentheses-mode
:documentation "Globally highlight surrounding parentheses."
:evil-leader "thP")
(progn
(when (memq dotspacemacs-highlight-delimiters '(all current))
(add-hook 'prog-mode-hook #'highlight-parentheses-mode))
(when (eq dotspacemacs-highlight-delimiters 'all)
(add-hook 'minibuffer-setup-hook #'highlight-parentheses-minibuffer-setup)))
:config (spacemacs|hide-lighter highlight-parentheses-mode)))
(defun spacemacs-editing-visual/init-indent-guide ()
(use-package indent-guide
:defer t
:custom
(indent-guide-delay 0.3)
:init
(progn
(spacemacs|add-toggle indent-guide
:mode indent-guide-mode
:documentation "Highlight indentation level at point. (alternative to highlight-indentation)."
:evil-leader "ti")
(spacemacs|add-toggle indent-guide-globally
:mode indent-guide-global-mode
:documentation "Highlight indentation level at point globally. (alternative to highlight-indentation)."
:evil-leader "t TAB"))
:spacediminish (" ⓘ" " i")))
(defun spacemacs-editing-visual/init-rainbow-delimiters ()
(use-package rainbow-delimiters
:defer t
:init
(progn
(spacemacs|add-toggle rainbow-delimiters
:mode rainbow-delimiters-mode
:documentation "Highlight nested parentheses, brackets, and braces according to their depth."
:evil-leader "tCd")
(when (memq dotspacemacs-highlight-delimiters '(any all))
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode)))))
(defun spacemacs-editing-visual/init-term-cursor ()
(use-package term-cursor
:if (not (display-graphic-p))
:defer t
:init (global-term-cursor-mode)))
(defun spacemacs-editing-visual/init-volatile-highlights ()
(use-package volatile-highlights
:defer t
:init
(progn
(spacemacs|add-toggle volatile-highlights
:mode volatile-highlights-mode
:documentation "Display visual feedback for some operations."
:evil-leader "thv")
(volatile-highlights-mode t))
:config
(progn
;; additional extensions
;; evil
(with-eval-after-load 'evil
(vhl/define-extension 'evil
'evil-move
'evil-paste-after
'evil-paste-before
'evil-paste-pop)
(vhl/install-extension 'evil)
(vhl/load-extension 'evil))
;; undo-tree
(with-eval-after-load 'undo-tree
(vhl/define-extension 'undo-tree
'undo-tree-move
'undo-tree-yank)
(vhl/install-extension 'undo-tree)
(vhl/load-extension 'undo-tree))
(spacemacs|hide-lighter volatile-highlights-mode))))
(defun spacemacs-editing-visual/init-writeroom-mode ()
(use-package writeroom-mode
:defer t
:custom (writeroom-mode-line-toggle-position 'mode-line-format)
:init
(progn
(spacemacs|add-toggle centered-buffer
:status writeroom-mode
:on (let ((writeroom-maximize-window nil)
(writeroom-mode-line t))
(writeroom-mode 1))
:on-message "Centered-buffer is enabled."
:off (writeroom-mode -1)
:off-message "Centered-buffer is disabled."
:documentation "Centerize current buffer."
:evil-leader "wcc")
(spacemacs|add-toggle distraction-free
:status writeroom-mode
:on (let ((writeroom-maximize-window t)
(writeroom-mode-line nil))
(writeroom-mode 1))
:on-message "Distraction-free is enabled."
:off (writeroom-mode -1)
:off-message "Distraction-free is disabled."
:documentation "Centerize and maximize current buffer."
:evil-leader "wcC")
(spacemacs/set-leader-keys "wc." #'spacemacs/centered-buffer-transient-state)
(spacemacs|define-transient-state centered-buffer
:title "Centered Buffer Transient State"
:bindings
("m" writeroom-toggle-mode-line "modeline")
("[" writeroom-decrease-width "shrink")
("]" writeroom-increase-width "enlarge")
("=" writeroom-adjust-width "adjust width")))))
;;; packages.el ends here