-
Notifications
You must be signed in to change notification settings - Fork 8
/
cpm-setup-meow.el
215 lines (199 loc) · 6.73 KB
/
cpm-setup-meow.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
;;; cpm-setup-meow.el --- summary -*- lexical-binding: t -*-
;; Author: Colin McLear
;; 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 <https://www.gnu.org/licenses/>.
;;; Commentary:
;; Setup and keybindings for modal interaction with Emacs. Currently I'm using Meow instead of evil/vim bindings.
;;; Code:
;;;; Meow Setup
(defun meow-setup ()
"Setup meow bindings."
(meow-motion-overwrite-define-key
'("s-[" . lem-previous-user-buffer)
'("s-]" . lem-next-user-buffer)
'("s-{" . tab-bar-switch-to-prev-tab)
'("s-}" . tab-bar-switch-to-next-tab)
'("j" . meow-next)
'("k" . meow-prev))
;; Set leader This isn't the sanctioned way to do this, but it seems to be the
;; only way to get `leader' to properly display keys from
;; `meow-leader-define-key' and my personal keymap in `lem+leader-map' I think
;; the preferred way is via (setq meow-keypad-leader-dispatch "...") but
;; that doesn't work as i want it to
(add-to-list 'meow-keymap-alist (cons 'leader lem+leader-map))
;; Keypad prefixes hijack personal keybinds so disable them
;; See https://github.com/meow-edit/meow/issues/206
(setq meow-keypad-meta-prefix nil
meow-keypad-ctrl-meta-prefix nil
meow-keypad-literal-prefix nil
meow-keypad-start-keys nil)
(meow-leader-define-key
;; ;; here we create bindings for necessary, high frequency commands
'("?" . consult-apropos)
;; high frequency keybindings
'(")" . "C-)")
'("}" . "C-}")
'("." . "M-.")
'("[" . lem-previous-user-buffer)
'("]" . lem-next-user-buffer)
'("{" . tab-bar-switch-to-prev-tab)
'("}" . tab-bar-switch-to-next-tab)
'("TAB" . lem-tab-bar-select-tab-dwim)
'("SPC" . execute-extended-command)
;; high frequency commands
'(";" . comment-line)
'("/" . meow-keypad-describe-key)
'("=" . hl-line-mode)
'("a" . consult-org-agenda)
'("b" . lem+buffer-keys)
'("c" . lem+comment-wrap-keys)
'("C" . lem+config-keys)
'("d" . dired-jump)
'("D" . dired-jump-other-window)
'("e" . lem+eval-keys)
'("E" . lem-call-emacs)
'("f" . lem+file-keys)
'("F" . lem+flymake-keys)
'("i" . lem-find-lambda-file)
'("I" . lem-search-lambda-files)
'("j" . avy-goto-char-timer)
'("J" . crux-top-join-line)
'("k" . consult-yank-from-kill-ring)
'("l" . vertico-repeat-last)
'("L" . consult-locate)
'("M" . lem+compile-keys)
'("n" . lem+notes-keys)
'("N" . consult-notes-search-all)
`("p" . ,project-prefix-map)
'("q" . lem+quit-keys)
'("r" . consult-register)
'("R" . consult-recent-file)
'("s" . lem+search-keys)
'("S" . lem+spelling-keys)
'("t" . lem+toggle-keys)
'("u" . lem+user-keys)
'("v" . lem+vc-keys)
'("V" . multi-vterm-dedicated-toggle)
'("w" . lem+window-keys)
'("W" . lem+workspace-keys)
'("y" . yas-minor-mode-map)
)
(meow-normal-define-key
'("0" . meow-expand-0)
'("9" . meow-expand-9)
'("8" . meow-expand-8)
'("7" . meow-expand-7)
'("6" . meow-expand-6)
'("5" . meow-expand-5)
'("4" . meow-expand-4)
'("3" . meow-expand-3)
'("2" . meow-expand-2)
'("1" . meow-expand-1)
'("-" . negative-argument)
'(";" . meow-reverse)
'(":" . meow-goto-line)
'("," . meow-inner-of-thing)
'("." . meow-bounds-of-thing)
'("[" . meow-beginning-of-thing)
'("]" . meow-end-of-thing)
'("a" . meow-append)
'("A" . meow-open-below)
'("b" . meow-back-word)
'("B" . meow-back-symbol)
'("c" . meow-change)
'("d" . meow-delete)
'("D" . meow-backward-delete)
'("e" . meow-next-word)
'("E" . meow-next-symbol)
'("f" . meow-find)
'("g" . beginning-of-buffer)
'("G" . end-of-buffer)
'("h" . meow-left)
'("H" . meow-left-expand)
'("i" . meow-insert)
'("I" . meow-open-above)
'("j" . meow-next)
'("J" . meow-next-expand)
'("k" . meow-prev)
'("K" . meow-prev-expand)
'("l" . meow-right)
'("L" . meow-right-expand)
'("m" . meow-join)
'("n" . meow-search)
'("o" . meow-block)
'("O" . meow-to-block)
'("p" . meow-yank)
'("q" . meow-quit)
'("r" . meow-replace)
'("R" . overwrite-mode)
'("s" . meow-kill)
'("S" . embrace-commander)
'("t" . meow-till)
'("u" . meow-undo)
'("U" . meow-undo-in-selection)
'("v" . meow-visit)
'("w" . meow-mark-word)
'("W" . meow-mark-symbol)
'("x" . meow-line)
'("X" . meow-swap-grab)
'("y" . meow-clipboard-save)
'("Y" . meow-sync-grab)
'("z" . meow-pop-selection)
'("'" . repeat)
'("&" . meow-query-replace-regexp)
'("%" . meow-query-replace)
'("=" . meow-grab)
'("s-[" . lem-previous-user-buffer)
'("s-]" . lem-next-user-buffer)
'("s-{" . tab-bar-switch-to-prev-tab)
'("s-}" . tab-bar-switch-to-next-tab)
'("<escape>" . meow-cancel-selection)))
;;;; Meow
;; Note load Meow before loading personal keybindings, otherwise some might get clobbered
(use-package meow
:custom
(meow-use-cursor-position-hack t)
(meow-use-clipboard t)
(meow-goto-line-function 'consult-goto-line)
:config
;; set colors in theme
(setq meow-use-dynamic-face-color nil)
;; Make sure delete char means delete char
;; see https://github.com/meow-edit/meow/issues/112
(setq meow--kbd-delete-char "<deletechar>")
(meow-thing-register 'angle '(regexp "<" ">") '(regexp "<" ">"))
(add-to-list 'meow-char-thing-table '(?a . angle))
(with-eval-after-load 'org
;; for use with meow movement
(modify-syntax-entry ?@ "_" org-mode-syntax-table))
;; start vterm in insert
(add-to-list 'meow-mode-state-list '(vterm-mode . insert))
;; start eshell in insert
(add-to-list 'meow-mode-state-list '(eshell-mode . insert))
;; mu4e views in motion
(add-to-list 'meow-mode-state-list '(mu4e-headers-mode . motion))
(add-to-list 'meow-mode-state-list '(mu4e-view-mode . motion))
;; start helpful in normal
;; (add-to-list 'meow-mode-state-list '(helpful-mode . normal))
(meow-global-mode 1)
(meow-setup))
;; Cooperate with splash page
(defun meow-lem-splash ()
;; Set no cursor with meow
(with-eval-after-load 'meow
(meow-motion-mode 1)
(setq-local meow-cursor-type-motion nil)
(ignore-errors
(revert-buffer))))
(add-hook 'lem-splash-mode-hook #'meow-lem-splash)
(provide 'cpm-setup-meow)
;;; cpm-setup-meow.el ends here