-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
keymap.json
208 lines (198 loc) · 6.41 KB
/
keymap.json
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
[
{
"context": "Editor && (vim_mode == normal || vim_mode == visual) && !VimWaiting && !menu",
"bindings": {
// put key-bindings here if you want them to work in normal & visual mode
// Git
"space g h d": "editor::ToggleHunkDiff",
"space g h r": "editor::RevertSelectedHunks",
// Toggle inlay hints
"space t i": "editor::ToggleInlayHints",
// Toggle soft wrap
"space u w": "editor::ToggleSoftWrap",
// NOTE: Toggle Zen mode, not fully working yet
"space c z": "workspace::ToggleCenteredLayout",
// Open markdown preview
"space m p": "markdown::OpenPreview",
"space m P": "markdown::OpenPreviewToTheSide",
// Open recent project
"space f p": "projects::OpenRecent",
// Search word under cursor
"space s w": "pane::DeploySearch",
// Chat with AI
"space a c": "assistant::ToggleFocus",
// Go to file with `gf`
"g f": "editor::OpenExcerpts"
}
},
{
"context": "Editor && vim_mode == normal && !VimWaiting && !menu",
"bindings": {
// put key-bindings here if you want them to work only in normal mode
// Window movement bindings
// Ctrl jklk to move between panes
"ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-j": ["workspace::ActivatePaneInDirection", "Down"],
// +LSP
"space c a": "editor::ToggleCodeActions",
"space .": "editor::ToggleCodeActions",
"space c r": "editor::Rename",
"g d": "editor::GoToDefinition",
"g D": "editor::GoToDefinitionSplit",
"g i": "editor::GoToImplementation",
"g I": "editor::GoToImplementationSplit",
"g t": "editor::GoToTypeDefinition",
"g T": "editor::GoToTypeDefinitionSplit",
"g r": "editor::FindAllReferences",
"] d": "editor::GoToDiagnostic",
"[ d": "editor::GoToPrevDiagnostic",
// TODO: Go to next/prev error
"] e": "editor::GoToDiagnostic",
"[ e": "editor::GoToPrevDiagnostic",
// Symbol search
"s s": "outline::Toggle",
"s S": "project_symbols::Toggle",
// Diagnostic
"space x x": "diagnostics::Deploy",
// +Git
// Git prev/next hunk
"] h": "editor::GoToHunk",
"[ h": "editor::GoToPrevHunk",
// TODO: git diff is not ready yet, refer https://github.com/zed-industries/zed/issues/8665#issuecomment-2194000497
// + Buffers
// Switch between buffers
"shift-h": "pane::ActivatePrevItem",
"shift-l": "pane::ActivateNextItem",
// Close active panel
"shift-q": "pane::CloseActiveItem",
"ctrl-q": "pane::CloseActiveItem",
"space b d": "pane::CloseActiveItem",
// Close other items
"space b o": "pane::CloseInactiveItems",
// Save file
"ctrl-s": "workspace::Save",
// File finder
"space space": "file_finder::Toggle",
// Project search
"space /": "pane::DeploySearch",
// TODO: Open other files
// Show project panel with current file
"space e": "pane::RevealInProjectPanel"
}
},
// Empty pane, set of keybindings that are available when there is no active editor
{
"context": "EmptyPane || SharedScreen",
"bindings": {
// Open file finder
"space space": "file_finder::Toggle",
// Open recent project
"space f p": "projects::OpenRecent"
}
},
// Comment code
{
"context": "Editor && vim_mode == visual && !VimWaiting && !menu",
"bindings": {
// visual, visual line & visual block modes
"g c": "editor::ToggleComments"
}
},
// Better escape
{
"context": "Editor && vim_mode == insert && !menu",
"bindings": {
"j j": "vim::NormalBefore", // remap jj in insert mode to escape
"j k": "vim::NormalBefore" // remap jk in insert mode to escape
}
},
// Rename
{
"context": "Editor && vim_operator == c",
"bindings": {
"c": "vim::CurrentLine",
"r": "editor::Rename" // zed specific
}
},
// Code Action
{
"context": "Editor && vim_operator == c",
"bindings": {
"c": "vim::CurrentLine",
"a": "editor::ToggleCodeActions" // zed specific
}
},
// Toggle terminal
{
"context": "Workspace",
"bindings": {
"ctrl-\\": "terminal_panel::ToggleFocus"
}
},
{
"context": "Terminal",
"bindings": {
"ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-j": ["workspace::ActivatePaneInDirection", "Down"]
}
},
// File panel (netrw)
{
"context": "ProjectPanel && not_editing",
"bindings": {
"a": "project_panel::NewFile",
"A": "project_panel::NewDirectory",
"r": "project_panel::Rename",
"d": "project_panel::Delete",
"x": "project_panel::Cut",
"c": "project_panel::Copy",
"p": "project_panel::Paste",
// Close project panel as project file panel on the right
"q": "workspace::ToggleRightDock",
"space e": "workspace::ToggleRightDock",
// Navigate between panel
"ctrl-h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-j": ["workspace::ActivatePaneInDirection", "Down"]
}
},
// Panel nagivation
{
"context": "Dock",
"bindings": {
"ctrl-w h": ["workspace::ActivatePaneInDirection", "Left"],
"ctrl-w l": ["workspace::ActivatePaneInDirection", "Right"],
"ctrl-w k": ["workspace::ActivatePaneInDirection", "Up"],
"ctrl-w j": ["workspace::ActivatePaneInDirection", "Down"]
}
},
{
"context": "Workspace",
"bindings": {
// Map VSCode like keybindings
"cmd-b": "workspace::ToggleRightDock"
}
},
// Run nearest task
{
"context": "EmptyPane || SharedScreen || vim_mode == normal",
"bindings": {
"space r t": ["editor::SpawnNearestTask", { "reveal": "no_focus" }]
}
}
// Subword motion is not working really nice with `ciw`, disable for now
// {
// "context": "VimControl && !menu",
// "bindings": {
// "w": "vim::NextSubwordStart",
// "b": "vim::PreviousSubwordStart",
// "e": "vim::NextSubwordEnd",
// "g e": "vim::PreviousSubwordEnd"
// }
// }
]