@@ -1,7 +1,8 @@
11# Keymap
22
3+## Normal mode
34
4−## Movement
5+### Movement
56
67| Key | Description |
78|-----|-----------|
@@ -12,7 +13,129 @@
1213| w | move next word start |
1314| b | move previous word start |
1415| e | move next word end |
16+| t | find 'till next char |
17+| f | find next char |
18+| T | find 'till previous char |
19+| F | find previous char |
20+| 0 | move to the start of the line |
21+| $ | move to the end of the line |
22+| m | Jump to matching bracket |
23+| PageUp | Move page up |
24+| PageDown | Move page down |
25+| ctrl-u | Move half page up |
26+| ctrl-d | Move half page down |
27+| Tab | Switch to next view |
28+| ctrl-i | Jump forward on the jumplist TODO: conflicts tab |
29+| ctrl-o | Jump backward on the jumplist |
30+| v | Enter select (extend) mode |
31+| g | Enter goto mode |
32+| : | Enter command mode |
33+| z | Enter view mode |
34+| space | Enter space mode |
35+| K | Show documentation for the item under the cursor |
36+
37+### Changes
38+
39+| Key | Description |
40+|-----|-----------|
41+| r | replace (single character change) |
42+| i | Insert before selection |
43+| a | Insert after selection (append) |
44+| I | Insert at the start of the line |
45+| A | Insert at the end of the line |
46+| o | Open new line below selection |
47+| o | Open new line above selection |
48+| u | Undo change |
49+| U | Redo change |
50+| y | Yank selection |
51+| p | Paste after selection |
52+| P | Paste before selection |
53+| > | Indent selection |
54+| < | Unindent selection |
55+| = | Format selection |
56+| d | Delete selection |
57+| c | Change selection (delete and enter insert mode) |
58+
59+### Selection manipulation
60+
61+| Key | Description |
62+|-----|-----------|
63+| s | Select all regex matches inside selections |
64+| S | Split selection into subselections on regex matches |
65+| alt-s | Split selection on newlines |
66+| ; | Collapse selection onto a single cursor |
67+| alt-; | Flip selection cursor and anchor |
68+| % | Select entire file |
69+| x | Select current line |
70+| X | Extend to next line |
71+| [ | Expand selection to parent syntax node TODO: pick a key |
72+| J | join lines inside selection |
73+| K | keep selections matching the regex TODO: overlapped by hover help |
74+| space | keep only the primary selection TODO: overlapped by space mode |
75+| ctrl-c | Comment/uncomment the selections |
76+
77+### Search
78+
79+> TODO: The search implementation isn't ideal yet -- we don't support searching
80+in reverse, or searching via smartcase.
81+
82+| Key | Description |
83+|-----|-----------|
84+| / | Search for regex pattern |
85+| n | Select next search match |
86+| N | Add next search match to selection |
87+| * | Use current selection as the search pattern |
88+
89+## Select / extend mode
90+
91+I'm still pondering whether to keep this mode or not. It changes movement
92+commands to extend the existing selection instead of replacing it.
93+
94+> NOTE: It's a bit confusing at the moment because extend hasn't been
95+> implemented for all movement commands yet.
96+
97+## View mode
98+
99+View mode is intended for scrolling and manipulating the view without changing
100+the selection.
101+
102+| Key | Description |
103+|-----|-----------|
104+| z , c | Vertically center the line |
105+| t | Align the line to the top of the screen |
106+| b | Align the line to the bottom of the screen |
107+| m | Align the line to the middle of the screen (horizontally) |
108+| j | Scroll the view downwards |
109+| k | Scroll the view upwards |
110+
111+## Goto mode
112+
113+Jumps to various locations.
114+
115+> NOTE: Some of these features are only available with the LSP present.
116+
117+| Key | Description |
118+|-----|-----------|
119+| g | Go to the start of the file |
120+| e | Go to the end of the file |
121+| e | Go to definition |
122+| t | Go to type definition |
123+| r | Go to references |
124+| i | Go to implementation |
125+
126+## Object mode
127+
128+TODO: Mappings for selecting syntax nodes (a superset of `[`).
129+
130+## Space mode
131+
132+This layer is a kludge of mappings I had under leader key in neovim.
15133
16134| Key | Description |
17135|-----|-----------|
18−| a | Append to end of selection |
136+| f | Open file picker |
137+| b | Open buffer picker |
138+| v | Open a new vertical split into the current file |
139+| w | Save changes to file |
140+| c | Close the current split |
141+| space | Keep primary selection TODO: it's here because space mode replaced it |