-
Notifications
You must be signed in to change notification settings - Fork 3
/
sniem-cheatsheet.el
335 lines (306 loc) · 34.4 KB
/
sniem-cheatsheet.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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
;;; sniem-cheatsheet.el --- Hands-eased united editing method -*- lexical-binding: t -*-
;; Author: SpringHan
;; Maintainer: SpringHan
;; This file is not part of GNU Emacs
;; This file 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, 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.
;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; Hands-eased united editing method.
;;; Code:
(require 's)
(require 'dash)
(require 'sniem-var)
(defconst sniem-cheatsheet-layout-qwerty
" Cheatsheet For Qwerty
┏━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━┓
┃ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ DEL ┃
┃ [~]| [!]| [@]| [#]| [$]| [%]| [^]| [&]| [*]| [(]| [)]| [_]| [+]| ┃
┠─┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ [DEL]┃
┃ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ ┃
┃ [`]| [1]| [2]| [3]| [4]| [5]| [6]| [7]| [8]| [9]| [0]| [-]| [=]| ┃
┠─────────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────────┨
┃ TAB │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │ { │ } │ | ┃
┃ | [Q]| [W]| [E]| [R]| [T]| [Y]| [U]| [I]| [O]| [P]| [{]| [}]| [|]┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┨
┃ │ q │ w │ e │ r │ t │ y │ u │ i │ o │ p │ [ │ ] │ \\ ┃
┃ | [q]| [w]| [e]| [r]| [t]| [y]| [u]| [i]| [o]| [p]| [[]| []]| [\\]┃
┠─────────────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─────────┨
┃ │ A │ S │ D │ F │ G │ H │ J │ K │ L │ : │ \" │ RET ┃
┃ | [A]| [S]| [D]| [F]| [G]| [H]| [J]| [K]| [L]| [:]| [\"]│ ┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ [RET]┃
┃ │ a │ s │ d │ f │ g │ h │ j │ k │ l │ ; │ ' │ ┃
┃ | [a]| [s]| [d]| [f]| [g]| [h]| [j]| [k]| [l]| [;]| [']| ┃
┠───────────────┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────────────────┨
┃ │ Z │ X │ C │ V │ B │ N │ M │ < │ > │ ? │ ┃
┃ | [Z]| [X]| [C]| [V]| [B]| [N]| [M]| [<]| [>]| [?]| ┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ ┃
┃ │ z │ x │ c │ v │ b │ n │ m │ , │ . │ / │ ┃
┃ | [z]| [x]| [c]| [v]| [b]| [n]| [m]| [,]| [.]| [/]| ┃
┗━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━╅─────────┴─────────┴─────────┴─────────╆━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━┛
┃ SPC ┃
┃ [SPC]┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
" )
(defconst sniem-cheatsheet-layout-dvp
" Cheatsheet For Programmer Dvorak
┏━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━┓
┃ ~ │ % │ 7 │ 5 │ 3 │ 1 │ 9 │ 0 │ 2 │ 4 │ 6 │ 8 │ ` │ DEL ┃
┃ [~]│ [%]│ [7]│ [5]│ [3]│ [1]│ [9]│ [0]│ [2]│ [4]│ [6]│ [8]│ [`]│ ┃
┠─┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ [DEL]┃
┃ $ │ & │ [ │ { │ } │ ( │ = │ * │ ) │ + │ ] │ ! │ # │ ┃
┃ [$]│ [&]│ [[]│ [{]│ [}]│ [(]│ [=]│ [*]│ [)]│ [+]│ []]│ [!]│ [#]│ ┃
┠─────────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────────┨
┃ TAB │ : │ < │ > │ P │ Y │ F │ G │ C │ R │ L │ ? │ ^ │ | ┃
┃ │ [:]│ [<]│ [>]│ [P]│ [Y]│ [F]│ [G]│ [C]│ [R]│ [L]│ [?]│ [^]│ [|]┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┨
┃ │ ; │ , │ . │ p │ y │ f │ g │ c │ r │ l │ / │ @ │ \\ ┃
┃ │ [;]│ [,]│ [.]│ [p]│ [y]│ [f]│ [g]│ [c]│ [r]│ [l]│ [/]│ [@]│ [\\]┃
┠─────────────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─────────┨
┃ │ A │ O │ E │ U │ I │ D │ H │ T │ N │ S │ _ │ RET ┃
┃ │ [A]│ [O]│ [E]│ [U]│ [I]│ [D]│ [H]│ [T]│ [N]│ [S]│ [_]│ ┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ [RET]┃
┃ │ a │ o │ e │ u │ i │ d │ h │ t │ n │ s │ - │ ┃
┃ │ [a]│ [o]│ [e]│ [u]│ [i]│ [d]│ [h]│ [t]│ [n]│ [s]│ [-]│ ┃
┠───────────────┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────────────────┨
┃ │ \" │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │ ┃
┃ │ [\"]│ [Q]│ [J]│ [K]│ [X]│ [B]│ [M]│ [W]│ [V]│ [Z]│ ┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ ┃
┃ │ ' │ q │ j │ k │ x │ b │ m │ w │ v │ z │ ┃
┃ │ [']│ [q]│ [j]│ [k]│ [x]│ [b]│ [m]│ [w]│ [v]│ [z]│ ┃
┗━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━╅─────────┴─────────┴─────────┴─────────╆━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━┛
┃ SPC ┃
┃ [SPC]┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
")
(defconst sniem-cheatsheet-layout-dvorak
" Cheatsheet For Dvorak Simplified
┏━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━┓
┃ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ { │ } │ DEL ┃
┃ [~]| [!]| [@]| [#]| [$]| [%]| [^]| [&]| [*]| [(]| [)]| [{]| [}]| ┃
┠─┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ [DEL]┃
┃ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ [ │ ] │ ┃
┃ [`]| [1]| [2]| [3]| [4]| [5]| [6]| [7]| [8]| [9]| [0]| [[]| []]| ┃
┠─────────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────────┨
┃ TAB │ \" │ < │ > │ P │ Y │ F │ G │ C │ R │ L │ ? │ + │ | ┃
┃ │ [\"]│ [<]│ [>]│ [P]│ [Y]│ [F]│ [G]│ [C]│ [R]│ [L]│ [?]│ [+]│ [|]┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┨
┃ │ ' │ , │ . │ p │ y │ f │ g │ c │ r │ l │ / │ = │ \\ ┃
┃ │ [']│ [,]│ [.]│ [p]│ [y]│ [f]│ [g]│ [c]│ [r]│ [l]│ [/]│ [=]│ [\\]┃
┠─────────────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─────────┨
┃ │ A │ O │ E │ U │ I │ D │ H │ T │ N │ S │ _ │ RET ┃
┃ │ [A]│ [O]│ [E]│ [U]│ [I]│ [D]│ [H]│ [T]│ [N]│ [S]│ [_]│ ┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ [RET]┃
┃ │ a │ o │ e │ u │ i │ d │ h │ t │ n │ s │ - │ ┃
┃ │ [a]│ [o]│ [e]│ [u]│ [i]│ [d]│ [h]│ [t]│ [n]│ [s]│ [-]│ ┃
┠───────────────┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────────────────┨
┃ │ : │ Q │ J │ K │ X │ B │ M │ W │ V │ Z │ ┃
┃ │ [:]│ [Q]│ [J]│ [K]│ [X]│ [B]│ [M]│ [W]│ [V]│ [Z]│ ┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ ┃
┃ │ ; │ q │ j │ k │ x │ b │ m │ w │ v │ z │ ┃
┃ │ [;]│ [q]│ [j]│ [k]│ [x]│ [b]│ [m]│ [w]│ [v]│ [z]│ ┃
┗━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━╅─────────┴─────────┴─────────┴─────────╆━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━┛
┃ SPC ┃
┃ [SPC]┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
")
(defconst sniem-cheatsheet-layout-colemak
" Cheatsheet For Colemak
┏━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━┯━━━━━━━━━━━━━┓
┃ ~ │ ! │ @ │ # │ $ │ % │ ^ │ & │ * │ ( │ ) │ _ │ + │ DEL ┃
┃ [~]| [!]| [@]| [#]| [$]| [%]| [^]| [&]| [*]| [(]| [)]| [_]| [+]| ┃
┠─┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ [DEL]┃
┃ ` │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ = │ ┃
┃ [`]| [1]| [2]| [3]| [4]| [5]| [6]| [7]| [8]| [9]| [0]| [-]| [=]| ┃
┠─────────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────┴───┬─────────┨
┃ TAB │ Q │ W │ F │ P │ G │ J │ L │ U │ Y │ : │ { │ } │ | ┃
┃ | [Q]| [W]| [F]| [P]| [G]| [J]| [L]| [U]| [Y]| [:]| [{]| [}]| [|]┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┨
┃ │ q │ w │ f │ p │ g │ j │ l │ u │ y │ ; │ [ │ ] │ \\ ┃
┃ | [q]| [w]| [f]| [p]| [g]| [j]| [l]| [u]| [y]| [;]| [[]| []]| [\\]┃
┠─────────────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─┬───────┴─────────┨
┃ │ A │ R │ S │ T │ D │ H │ N │ E │ I │ O │ \" │ RET ┃
┃ | [A]| [R]| [S]| [T]| [D]| [H]| [N]| [E]| [I]| [O]| [\"]│ ┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ [RET]┃
┃ │ a │ r │ s │ t │ d │ h │ n │ e │ i │ o │ ' │ ┃
┃ | [a]| [r]| [s]| [t]| [d]| [h]| [n]| [e]| [i]| [o]| [']| ┃
┠───────────────┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────┬───┴─────────────────┨
┃ │ Z │ X │ C │ V │ B │ K │ M │ < │ > │ ? │ ┃
┃ | [Z]| [X]| [C]| [V]| [B]| [K]| [M]| [<]| [>]| [?]| ┃
┃ ├┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┼┄┄┄┄┄┄┄┄┄┤ ┃
┃ │ z │ x │ c │ v │ b │ k │ m │ , │ . │ / │ ┃
┃ | [z]| [x]| [c]| [v]| [b]| [k]| [m]| [,]| [.]| [/]| ┃
┗━━━━━━━━━━━━━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━╅─────────┴─────────┴─────────┴─────────╆━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━┷━━━━━━━━━━━━━━━━━━━━━┛
┃ SPC ┃
┃ [SPC]┃
┃ ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
" )
(defconst sniem-cheatsheet-keys
'("a" "A" "b" "B" "c" "C" "d" "D" "e" "E" "f" "F" "g" "G" "h" "H" "i" "I" "j" "J"
"k" "K" "l" "L" "m" "M" "n" "N" "o" "O" "p" "P" "q" "Q" "r" "R" "s" "S" "t" "T"
"u" "U" "v" "V" "w" "W" "x" "X" "y" "Y" "z" "Z" "0" "1" "2" "3" "4" "5" "6" "7"
"8" "9" "!" "@" "" "$" "%" "^" "&" "*" "" "~" "-" "_" "=" "+" "," "<" "." ">"
"/" "?" "(" ")" "[" "]" "{" "}" "\\" "|" ";" ":" "'" "\"" "#" "`" "SPC" "RET" "DEL"))
(defcustom sniem-cheatsheet-special-key-space
'(("" . " ")
("" . " ")
(" " . " "))
"The space for special key."
:type 'list
:group 'sniem)
(defcustom sniem-cheatsheet-special-key-width
'(("" . 13)
("" . 17)
(" " . 39))
"The space for special key."
:type 'list
:group 'sniem)
(defcustom sniem-cheatsheet-short-commands
'((sniem-forward-char . "→")
(sniem-backward-char . "←")
(sniem-5-forward-char . "5*→")
(sniem-5-backward-char . "←*5")
(sniem-next-line . "↓")
(sniem-prev-line . "↑")
(sniem-5-next-line . "↓*5")
(sniem-5-prev-line . "↑*5")
(digit-argument . "num-arg")
(sniem-digit-argument-or-fn . "num-arg-middle-keyboard-with-functions")
(sniem-beginning-of-line . "line-beg")
(sniem-end-of-line . "line-end")
(sniem-first-line . "1st line")
(sniem-goto-line . "goto-line")
(sniem-next-word . "word →")
(sniem-prev-word . "word ←")
(sniem-next-symbol . "symbol→")
(sniem-prev-symbol . "symbol←")
(sniem-beg-of-mark . "mark-beg")
(sniem-end-of-mark . "mark-end")
(sniem-lock-unlock-last-point . "lock-LP")
(sniem-goto-last-point . "goto-LP")
(sniem-move-last-point . "move-LP-p")
(sniem-goto-next . "lines ↓")
(sniem-goto-prev . "lines ↑")
(sniem-find-forward . "find →")
(sniem-find-backward . "find ←")
(sniem-up-down-case . "↑/↓ case")
(save-buffers-kill-terminal . "exit")
(sniem-yank-in-region . "Y [mark]")
(sniem-delete-in-region . "D [mark]")
(sniem-change-in-region . "C [mark]")
(sniem-paste-in-region . "P [mark]")
(sniem-keyboard-quit . "quit")
(sniem-append-line . "A-line")
(sniem-insert-line . "I-line")
(sniem-delete-char . "D-char")
(sniem-scroll-up-command . "page ↓")
(sniem-scroll-down-command . "page ↑")
(sniem-object-catch-round . "OC-(")
(sniem-object-catch-square . "OC-[")
(sniem-object-catch-curly . "OC-{")
(sniem-replace-char . "R-char")
(sniem-replace-word . "R-word")
(eval-last-sexp . "eval")
(save-buffer . "save")
(execute-extended-command . "M-x")
(sniem-open-line . "new-line↓")
(sniem-open-line-previous . "new-line↑")
(sniem-cheatsheet . "cheatpage"))
"The short commands."
:type 'list
:group 'sniem)
(defun sniem-cheatsheet ()
"Switch to the cheatsheet buffer and insert the cheatsheet."
(interactive)
(if (null sniem-keyboard-layout)
(user-error "[Sniem]: You should set `sniem-keyboard-layout' first!")
(let ((cheatsheet-layout (pcase sniem-keyboard-layout
('dvp sniem-cheatsheet-layout-dvp)
('dvorak sniem-cheatsheet-layout-dvorak)
('colemak sniem-cheatsheet-layout-colemak)
('qwerty sniem-cheatsheet-layout-qwerty))))
(-> (propertize cheatsheet-layout 'face 'font-lock-comment-face)
(sniem-cheatsheet--replace)
(sniem-cheatsheet--show-cheatsheet)))))
(defun sniem-cheatsheet--show-cheatsheet (cs)
"Show the cheatsheet.
Argument CS is the cheatsheet of current keyboard."
(with-current-buffer (get-buffer-create "*Sniem Cheatsheet*")
(setq-local buffer-read-only nil)
(erase-buffer)
(insert cs)
(insert "\nNOTE:\n"
(propertize "[mark]" 'face 'font-lock-constant-face)
" means the operation will edit the regions' content. You can mark a content, "
"then use operations with [mark] sign to edit them.\n"
(propertize "LP" 'face 'font-lock-constant-face)
" means the last-point, all of the sniem motions and most of the operations will use it.")
(text-mode)
(toggle-truncate-lines t)
(display-line-numbers-mode -1)
(line-number-mode -1)
(setq-local buffer-read-only t))
(switch-to-buffer "*Sniem Cheatsheet*")
(goto-char (point-min)))
(defun sniem-cheatsheet--replace (cs)
"Replace the keys in the cheatsheet.
Argument CS is the cheatsheet of current keyboard."
(-reduce-from
(lambda (cs key)
(let* ((ckey (kbd key))
(cmd (key-binding ckey))
tmp)
(if (and cmd (or (keymapp cmd) (symbolp cmd)))
(let ((case-fold-search nil))
(s-replace
(format (if (setq tmp (alist-get ckey sniem-cheatsheet-special-key-space nil nil 'equal))
(concat tmp "[%s]")
" [%s]")
key)
(if (keymapp cmd)
" leader"
(sniem-cheatsheet--command cmd ckey))
cs))
cs)))
cs sniem-cheatsheet-keys))
(defun sniem-cheatsheet--command (cmd key)
"Replace the command to short.
Argument CMD is the command.
Argument KEY is the key of command."
(let ((scmd (or (alist-get cmd sniem-cheatsheet-short-commands)
(s-replace "sniem-" "" (symbol-name cmd))))
(sp-cmd-space (when (sniem-cheatsheet--special-key-p cmd key)
(alist-get key sniem-cheatsheet-special-key-width nil nil 'equal))))
(when scmd
(when (string= "undefined" scmd)
(setq scmd ""))
(if (<= (length scmd) (or sp-cmd-space 9))
(-> (->> (or sp-cmd-space 9)
(number-to-string)
(concat "% "))
(concat "s")
(format scmd))
(s-truncate (or sp-cmd-space 9) scmd)))))
(defun sniem-cheatsheet--special-key-p (cmd key)
"Check if the KEY for CMD is included in `sniem-cheatsheet-special-key-space'."
(catch 'p
(mapc `(lambda (k)
(when (and (equal ,key k) (eq (key-binding k) ',cmd))
(throw 'p k)))
'(" " "" ""))))
(provide 'sniem-cheatsheet)
;;; sniem-cheatsheet.el ends here