forked from ztlevi/doom-config
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bindings.el
195 lines (181 loc) · 7.05 KB
/
bindings.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
;;; bindings.el -*- lexical-binding: t; -*-
(when IS-MAC (setq mac-command-modifier 'meta
mac-option-modifier 'alt))
;; Distinguish C-i from TAB
(when (display-graphic-p)
(define-key input-decode-map "\C-i" [C-i])
(map! "<C-i>" #'better-jumper-jump-forward))
(evil-ex-define-cmd "W" 'evil-write)
(map!
:gi "C-n" #'next-line
:gi "C-p" #'previous-line
:gi "C-b" #'backward-char
:gi "C-f" #'forward-char
:gi "C-k" #'kill-line
:gi "C-d" #'delete-forward-char
:gi "C-<backspace>" #'delete-block-backward
:v "DEL" (kbd "\"_d")
:v "<del>" (kbd "\"_d")
:v "<backspace>" (kbd "\"_d")
:nmv "-" (λ! (better-jumper-jump-backward 1))
:nmv "=" (λ! (better-jumper-jump-forward 1))
:nmv "/" #'swiper
)
(map! :leader
:desc "project-find-file" :nmv "SPC" #'projectile-find-file
(:prefix "c"
:desc "Toggle Comment" "/" #'doom/toggle-comment-region-or-line
:desc "Glance doc" "g" #'lsp-ui-doc-glance
)
(:prefix "TAB"
:desc "Switch workspace" "TAB" #'+workspace/other)
(:prefix "f"
:desc "Save all" "S" #'evil-write-all
:desc "Deer" "j" #'deer
)
(:prefix "g"
"s" nil
:desc "Status" "s" #'magit-status
:desc "Gitmoji picker" "m" #'gitmoji-picker
)
(:prefix "h"
:desc "Helpful command" "C" #'helpful-command)
(:prefix-map ("j" . "jump")
:desc "Jump to character" "j" #'evil-avy-goto-char
:desc "Jump to line" "l" #'evil-avy-goto-line
:desc "Jump to character 2" "J" #'evil-avy-goto-char-2)
(:prefix-map ("e" . "error")
:desc "Flymake next error" "N" #'flymake-goto-next-error
:desc "Flymake previous error" "P" #'flymake-goto-prev-error
:desc "Flymake list errors" "L" #'flymake-show-diagnostics-buffer
:desc "Flycheck next error" "n" #'flycheck-next-error
:desc "Flycheck previous error" "p" #'flycheck-previous-error
:desc "Flycheck explain error" "e" #'flycheck-explain-error-at-point
:desc "Flycheck list errors" "l" #'flycheck-list-errors
:desc "Flycheck verify setup" "v" #'flycheck-verify-setup)
(:prefix "l"
:desc "Treemacs Symbols" "i" #'lsp-treemacs-symbols
:desc "Treemacs References" "r" #'lsp-treemacs-references
:desc "Treemacs Errors" "e" #'lsp-treemacs-errors-list)
(:prefix "o" ; open
:desc "Kill ring" "k" #'helm-show-kill-ring
:desc "Treemacs Symbols" "i" #'lsp-treemacs-symbols
:desc "Open link" "x" #'link-hint-open-link
:desc "Open link at point" "X" #'link-hint-open-link-at-point
:desc "Vterm" "s" #'+vterm/toggle
:desc "Project run Vterm" "S" #'+vterm/here
:desc "Toggle eshell popup" "e" #'+eshell/toggle
:desc "Project run Eshell" "E" #'projectile-run-eshell
(:when IS-MAC
:desc "Reveal in default program" "f" #'+macos/open-in-default-program
:desc "Reveal in Finder" "o" #'+macos/reveal-in-finder
:desc "Reveal project in Finder" "O" #'+macos/reveal-project-in-finder
:desc "Reveal in Terminal" "t" #'+macos/reveal-in-terminal
:desc "Reveal project in Terminal" "T" #'+macos/reveal-project-in-terminal
:desc "Reveal file in Apps" "," #'+shell/reveal-in-apps
:desc "Reveal project in Apps" "." #'+shell/reveal-project-in-apps)
(:when IS-LINUX
:desc "Reveal in default program" "f" #'+shell/open-in-default-program
:desc "Reveal in Finder" "o" #'+shell/reveal-in-finder
:desc "Reveal project in Finder" "O" #'+shell/reveal-project-in-finder
:desc "Reveal in Terminal" "t" #'+shell/reveal-in-terminal
:desc "Reveal project in Terminal" "T" #'+shell/reveal-project-in-terminal
:desc "Reveal file in Apps" "," #'+shell/reveal-in-apps
:desc "Reveal project in Apps" "." #'+shell/reveal-project-in-apps))
(:prefix "p" ; project
:desc "Update projectile list" "u" #'update-projectile-known-projects)
(:prefix ("d" . "debug")
"b" #'dap-breakpoint-toggle
"h" #'dap-hydra
"l" #'dap-ui-locals
"s" #'dap-ui-sessions
"k" #'dap-delete-session
"K" #'dap-delete-all-sessions
"S" #'realgud-short-key-mode)
(:prefix "t" ; toggle
"d" #'toggle-debug-on-error
"L" #'toggle-truncate-lines
"S" #'size-indication-mode
"I" #'ivy-rich-mode
"v" #'visual-line-mode)
(:prefix "s" ; search
(:when IS-LINUX
:desc "Open App" "a" #'counsel-linux-app)
(:when IS-MAC
:desc "Open App" "a" #'counsel-osx-app)
:desc "Comments" "c" #'counsel-imenu-comments
:desc "Search project with regex" "P" #'+default/search-project-regex
:desc "Project (hidden)" "h" #'+ivy/project-search-with-hidden-files)
(:prefix ("l" . "Leetcode")
"l" #'leetcode
"s" #'leetcode-submit
"t" #'leetcode-try
"r" #'leetcode-refresh
"R" #'leetcode-refresh-fetch
"f" #'leetcode-set-filter-difficulty
"." #'leetcode-reset-filter)
)
(map!
(:after lsp-ui
:map lsp-ui-mode-map
"C-j" (λ!! #'lsp-ui-doc-mode))
(:after lsp-ui-peek
:map lsp-ui-peek-mode-map
"h" #'lsp-ui-peek--select-prev-file
"j" #'lsp-ui-peek--select-next
"k" #'lsp-ui-peek--select-prev
"l" #'lsp-ui-peek--select-next-file)
(:after js2-mode
(:map js2-mode-map
:localleader
(:prefix ("d" . "Docstring")
:desc "Function doc" "f" #'js-doc-insert-function-doc
:desc "File doc" "F" #'js-doc-insert-file-doc
:desc "Insert Tag" "t" #'js-doc-insert-tag
)))
(:after python
:localleader
:map python-mode-map
(:prefix ("i" . "Import")
:desc "Import at point" "i" #'importmagic-fix-symbol-at-point
:desc "Import all" "a" #'importmagic-fix-imports
:desc "Sort imports" "s" #'+python/python-sort-imports)
(:prefix ("p" . "Poetry")
:desc "Poetry Menu" "p" #'poetry
:desc "Add" "a" #'poetry-add
:desc "Lock" "l" #'poetry-lock
:desc "Show" "s" #'poetry-show
:desc "virtualenv" "v" #'poetry-venv-toggle
)
(:prefix ("t" . "Test")
:desc "Test file" "f" #'python-pytest-file
:desc "Test function" "t" #'python-pytest-function
:desc "Test last failed" "l" #'python-pytest-last-failed
:desc "Popup test panel" "p" #'python-pytest-popup
:desc "Test repeat" "r" #'python-pytest-repeat
)
:desc "Docstring" "d" #'sphinx-doc
(:prefix ("v" . "ENV")
"w" #'pyvenv-workon
"v" #'pyvenv-activate
"V" #'pyvenv-deactivate
))
)
(map!
(:map awesome-pair-mode-map
"M-p" #'awesome-pair-jump-left
"M-n" #'awesome-pair-jump-right
"M-:" #'awesome-pair-jump-out-pair-and-newline
"M-{" #'awesome-pair-wrap-curly
"M-[" #'awesome-pair-wrap-bracket
"M-(" #'awesome-pair-wrap-round
"M-)" #'awesome-pair-unwrap)
)
(map!
(:after company
(:map (company-active-map evil-insert-state-map)
"C-o" #'smarter-yas-expand-next-field-complete)))
(map!
(:map rime-mode-map
"M-j" #'rime-inline-ascii
))