on master help sign in
Update keymap documentation in the book (#1745)
e8cc7acDaniel S Poulin
book/src/keymap.md+138−118
@@ -9,42 +9,33 @@
9
9
10> NOTE: Unlike vim, `f`, `F`, `t` and `T` are not confined to the current line.
10> NOTE: Unlike vim, `f`, `F`, `t` and `T` are not confined to the current line.
11
11
12−| Key | Description | Command |
12+| Key | Description | Command |
13−| ----- | ----------- | ------- |
13+| ----- | ----------- | ------- |
14−| `h`/`Left` | Move left | `move_char_left` |
14+| `h`, `Left` | Move left | `move_char_left` |
15−| `j`/`Down` | Move down | `move_line_down` |
15+| `j`, `Down` | Move down | `move_line_down` |
16−| `k`/`Up` | Move up | `move_line_up` |
16+| `k`, `Up` | Move up | `move_line_up` |
17−| `l`/`Right` | Move right | `move_char_right` |
17+| `l`, `Right` | Move right | `move_char_right` |
18−| `w` | Move next word start | `move_next_word_start` |
18+| `w` | Move next word start | `move_next_word_start` |
19−| `b` | Move previous word start | `move_prev_word_start` |
19+| `b` | Move previous word start | `move_prev_word_start` |
20−| `e` | Move next word end | `move_next_word_end` |
20+| `e` | Move next word end | `move_next_word_end` |
21−| `W` | Move next WORD start | `move_next_long_word_start` |
21+| `W` | Move next WORD start | `move_next_long_word_start` |
22−| `B` | Move previous WORD start | `move_prev_long_word_start` |
22+| `B` | Move previous WORD start | `move_prev_long_word_start` |
23−| `E` | Move next WORD end | `move_next_long_word_end` |
23+| `E` | Move next WORD end | `move_next_long_word_end` |
24−| `t` | Find 'till next char | `find_till_char` |
24+| `t` | Find 'till next char | `find_till_char` |
25−| `f` | Find next char | `find_next_char` |
25+| `f` | Find next char | `find_next_char` |
26−| `T` | Find 'till previous char | `till_prev_char` |
26+| `T` | Find 'till previous char | `till_prev_char` |
27−| `F` | Find previous char | `find_prev_char` |
27+| `F` | Find previous char | `find_prev_char` |
28−| `G` | Go to line number `<n>` | `goto_line` |
28+| `G` | Go to line number `<n>` | `goto_line` |
29−| `Alt-.` | Repeat last motion (`f`, `t` or `m`) | `repeat_last_motion` |
29+| `Alt-.` | Repeat last motion (`f`, `t` or `m`) | `repeat_last_motion` |
30−| `Alt-:` | Ensures the selection is in forward direction | `ensure_selections_forward` |
31−| `Home` | Move to the start of the line | `goto_line_start` |
30+| `Home` | Move to the start of the line | `goto_line_start` |
32−| `End` | Move to the end of the line | `goto_line_end` |
31+| `End` | Move to the end of the line | `goto_line_end` |
33−| `PageUp` | Move page up | `page_up` |
32+| `Ctrl-b`, `PageUp` | Move page up | `page_up` |
34−| `PageDown` | Move page down | `page_down` |
33+| `Ctrl-f`, `PageDown` | Move page down | `page_down` |
35−| `Ctrl-u` | Move half page up | `half_page_up` |
34+| `Ctrl-u` | Move half page up | `half_page_up` |
36−| `Ctrl-d` | Move half page down | `half_page_down` |
35+| `Ctrl-d` | Move half page down | `half_page_down` |
37−| `Ctrl-i` | Jump forward on the jumplist | `jump_forward` |
36+| `Ctrl-i` | Jump forward on the jumplist | `jump_forward` |
38−| `Ctrl-o` | Jump backward on the jumplist | `jump_backward` |
37+| `Ctrl-o` | Jump backward on the jumplist | `jump_backward` |
39−| `Ctrl-s` | Save the current selection to the jumplist | `save_selection` |
38+| `Ctrl-s` | Save the current selection to the jumplist | `save_selection` |
40−| `v` | Enter [select (extend) mode](#select--extend-mode) | `select_mode` |
41−| `g` | Enter [goto mode](#goto-mode) | N/A |
42−| `m` | Enter [match mode](#match-mode) | N/A |
43−| `:` | Enter command mode | `command_mode` |
44−| `z` | Enter [view mode](#view-mode) | N/A |
45−| `Z` | Enter sticky [view mode](#view-mode) | N/A |
46−| `Ctrl-w` | Enter [window mode](#window-mode) | N/A |
47−| `Space` | Enter [space mode](#space-mode) | N/A |
48
39
49### Changes
40### Changes
50
41
@@ -84,48 +75,50 @@
84
75
85#### Shell
76#### Shell
86
77
87−| Key | Description | Command |
78+| Key | Description | Command |
88−| ------ | ----------- | ------- |
79+| ------ | ----------- | ------- |
89−| <code>&#124;</code> | Pipe each selection through shell command, replacing with output | `shell_pipe` |
80+| `|` | Pipe each selection through shell command, replacing with output | `shell_pipe` |
90−| <code>Alt-&#124;</code> | Pipe each selection into shell command, ignoring output | `shell_pipe_to` |
81+| `Alt-|` | Pipe each selection into shell command, ignoring output | `shell_pipe_to` |
91−| `!` | Run shell command, inserting output before each selection | `shell_insert_output` |
82+| `!` | Run shell command, inserting output before each selection | `shell_insert_output` |
92−| `Alt-!` | Run shell command, appending output after each selection | `shell_append_output` |
83+| `Alt-!` | Run shell command, appending output after each selection | `shell_append_output` |
93| `$` | Pipe each selection into shell command, keep selections where command returned 0 | `shell_keep_pipe` |
84| `$` | Pipe each selection into shell command, keep selections where command returned 0 | `shell_keep_pipe` |
94
85
95
86
96### Selection manipulation
87### Selection manipulation
97
88
98−| Key | Description | Command |
89+| Key | Description | Command |
99−| ----- | ----------- | ------- |
90+| ----- | ----------- | ------- |
100−| `s` | Select all regex matches inside selections | `select_regex` |
91+| `s` | Select all regex matches inside selections | `select_regex` |
101−| `S` | Split selection into subselections on regex matches | `split_selection` |
92+| `S` | Split selection into subselections on regex matches | `split_selection` |
102−| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
93+| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
103−| `&` | Align selection in columns | `align_selections` |
94+| `&` | Align selection in columns | `align_selections` |
104−| `_` | Trim whitespace from the selection | `trim_selections` |
95+| `_` | Trim whitespace from the selection | `trim_selections` |
105−| `;` | Collapse selection onto a single cursor | `collapse_selection` |
96+| `;` | Collapse selection onto a single cursor | `collapse_selection` |
106−| `Alt-;` | Flip selection cursor and anchor | `flip_selections` |
97+| `Alt-;` | Flip selection cursor and anchor | `flip_selections` |
98+| `Alt-:` | Ensures the selection is in forward direction | `ensure_selections_forward` |
107−| `,` | Keep only the primary selection | `keep_primary_selection` |
99+| `,` | Keep only the primary selection | `keep_primary_selection` |
108−| `Alt-,` | Remove the primary selection | `remove_primary_selection` |
100+| `Alt-,` | Remove the primary selection | `remove_primary_selection` |
109−| `C` | Copy selection onto the next line (Add cursor below) | `copy_selection_on_next_line` |
101+| `C` | Copy selection onto the next line (Add cursor below) | `copy_selection_on_next_line` |
110−| `Alt-C` | Copy selection onto the previous line (Add cursor above) | `copy_selection_on_prev_line` |
102+| `Alt-C` | Copy selection onto the previous line (Add cursor above) | `copy_selection_on_prev_line` |
111−| `(` | Rotate main selection backward | `rotate_selections_backward` |
103+| `(` | Rotate main selection backward | `rotate_selections_backward` |
112−| `)` | Rotate main selection forward | `rotate_selections_forward` |
104+| `)` | Rotate main selection forward | `rotate_selections_forward` |
113−| `Alt-(` | Rotate selection contents backward | `rotate_selection_contents_backward` |
105+| `Alt-(` | Rotate selection contents backward | `rotate_selection_contents_backward` |
114−| `Alt-)` | Rotate selection contents forward | `rotate_selection_contents_forward` |
106+| `Alt-)` | Rotate selection contents forward | `rotate_selection_contents_forward` |
115−| `%` | Select entire file | `select_all` |
107+| `%` | Select entire file | `select_all` |
116−| `x` | Select current line, if already selected, extend to next line | `extend_line` |
108+| `x` | Select current line, if already selected, extend to next line | `extend_line` |
117−| `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` |
109+| `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` |
118−| `J` | Join lines inside selection | `join_selections` |
110+| `J` | Join lines inside selection | `join_selections` |
119−| `K` | Keep selections matching the regex | `keep_selections` |
111+| `K` | Keep selections matching the regex | `keep_selections` |
120−| `Alt-K` | Remove selections matching the regex | `remove_selections` |
112+| `Alt-K` | Remove selections matching the regex | `remove_selections` |
121−| `Ctrl-c` | Comment/uncomment the selections | `toggle_comments` |
113+| `Ctrl-c` | Comment/uncomment the selections | `toggle_comments` |
122−| `Alt-k`/`Alt-up` | Expand selection to parent syntax node (**TS**) | `expand_selection` |
114+| `Alt-k`, `Alt-up` | Expand selection to parent syntax node (**TS**) | `expand_selection` |
123−| `Alt-j`/`Alt-down` | Shrink syntax tree object selection (**TS**) | `shrink_selection` |
115+| `Alt-j`, `Alt-down` | Shrink syntax tree object selection (**TS**) | `shrink_selection` |
124−| `Alt-h`/`Alt-left` | Select previous sibling node in syntax tree (**TS**) | `select_prev_sibling` |
116+| `Alt-h`, `Alt-left` | Select previous sibling node in syntax tree (**TS**) | `select_prev_sibling` |
125−| `Alt-l`/`Alt-right` | Select next sibling node in syntax tree (**TS**) | `select_next_sibling` |
117+| `Alt-l`, `Alt-right` | Select next sibling node in syntax tree (**TS**) | `select_next_sibling` |
126
118
127### Search
119### Search
128
120
121+Search commands all operate on the `/` register by default. Use `"<char>` to operate on a different one.
129
122
130| Key | Description | Command |
123| Key | Description | Command |
131| ----- | ----------- | ------- |
124| ----- | ----------- | ------- |
@@ -139,6 +132,17 @@
139
132
140These sub-modes are accessible from normal mode and typically switch back to normal mode after a command.
133These sub-modes are accessible from normal mode and typically switch back to normal mode after a command.
141
134
135+| Key | Description | Command |
136+| ----- | ----------- | ------- |
137+| `v` | Enter [select (extend) mode](#select--extend-mode) | `select_mode` |
138+| `g` | Enter [goto mode](#goto-mode) | N/A |
139+| `m` | Enter [match mode](#match-mode) | N/A |
140+| `:` | Enter command mode | `command_mode` |
141+| `z` | Enter [view mode](#view-mode) | N/A |
142+| `Z` | Enter sticky [view mode](#view-mode) | N/A |
143+| `Ctrl-w` | Enter [window mode](#window-mode) | N/A |
144+| `Space` | Enter [space mode](#space-mode) | N/A |
145+
142#### View mode
146#### View mode
143
147
144View mode is intended for scrolling and manipulating the view without changing
148View mode is intended for scrolling and manipulating the view without changing
@@ -147,18 +151,18 @@ key to return to normal mode after usage (useful when you're simply looking
147over text and not actively editing it).
151over text and not actively editing it).
148
152
149
153
150−| Key | Description | Command |
154+| Key | Description | Command |
151−| ----- | ----------- | ------- |
155+| ----- | ----------- | ------- |
152−| `z` , `c` | Vertically center the line | `align_view_center` |
156+| `z`, `c` | Vertically center the line | `align_view_center` |
153−| `t` | Align the line to the top of the screen | `align_view_top` |
157+| `t` | Align the line to the top of the screen | `align_view_top` |
154−| `b` | Align the line to the bottom of the screen | `align_view_bottom` |
158+| `b` | Align the line to the bottom of the screen | `align_view_bottom` |
155−| `m` | Align the line to the middle of the screen (horizontally) | `align_view_middle` |
159+| `m` | Align the line to the middle of the screen (horizontally) | `align_view_middle` |
156−| `j` , `down` | Scroll the view downwards | `scroll_down` |
160+| `j`, `down` | Scroll the view downwards | `scroll_down` |
157−| `k` , `up` | Scroll the view upwards | `scroll_up` |
161+| `k`, `up` | Scroll the view upwards | `scroll_up` |
158−| `Ctrl-f` | Move page down | `page_down` |
162+| `Ctrl-f`, `PageDown` | Move page down | `page_down` |
159−| `Ctrl-b` | Move page up | `page_up` |
163+| `Ctrl-b`, `PageUp` | Move page up | `page_up` |
160−| `Ctrl-d` | Move half page down | `half_page_down` |
164+| `Ctrl-d` | Move half page down | `half_page_down` |
161−| `Ctrl-u` | Move half page up | `half_page_up` |
165+| `Ctrl-u` | Move half page up | `half_page_up` |
162
166
163#### Goto mode
167#### Goto mode
164
168
@@ -206,19 +210,19 @@ TODO: Mappings for selecting syntax nodes (a superset of `[`).
206
210
207This layer is similar to vim keybindings as kakoune does not support window.
211This layer is similar to vim keybindings as kakoune does not support window.
208
212
209−| Key | Description | Command |
213+| Key | Description | Command |
210−| ----- | ------------- | ------- |
214+| ----- | ------------- | ------- |
211−| `w`, `Ctrl-w` | Switch to next window | `rotate_view` |
215+| `w`, `Ctrl-w` | Switch to next window | `rotate_view` |
212−| `v`, `Ctrl-v` | Vertical right split | `vsplit` |
216+| `v`, `Ctrl-v` | Vertical right split | `vsplit` |
213−| `s`, `Ctrl-s` | Horizontal bottom split | `hsplit` |
217+| `s`, `Ctrl-s` | Horizontal bottom split | `hsplit` |
214−| `h`, `Ctrl-h`, `left` | Move to left split | `jump_view_left` |
215−| `f` | Go to files in the selection in horizontal splits | `goto_file` |
218+| `f` | Go to files in the selection in horizontal splits | `goto_file` |
216−| `F` | Go to files in the selection in vertical splits | `goto_file` |
219+| `F` | Go to files in the selection in vertical splits | `goto_file` |
220+| `h`, `Ctrl-h`, `Left` | Move to left split | `jump_view_left` |
217−| `j`, `Ctrl-j`, `down` | Move to split below | `jump_view_down` |
221+| `j`, `Ctrl-j`, `Down` | Move to split below | `jump_view_down` |
218−| `k`, `Ctrl-k`, `up` | Move to split above | `jump_view_up` |
222+| `k`, `Ctrl-k`, `Up` | Move to split above | `jump_view_up` |
219−| `l`, `Ctrl-l`, `right` | Move to right split | `jump_view_right` |
223+| `l`, `Ctrl-l`, `Right` | Move to right split | `jump_view_right` |
220−| `q`, `Ctrl-q` | Close current window | `wclose` |
224+| `q`, `Ctrl-q` | Close current window | `wclose` |
221−| `o`, `Ctrl-o` | Only keep the current window, closing all the others | `wonly` |
225+| `o`, `Ctrl-o` | Only keep the current window, closing all the others | `wonly` |
222
226
223#### Space mode
227#### Space mode
224
228
@@ -242,6 +246,7 @@ This layer is a kludge of mappings, mostly pickers.
242| `Y` | Yank main selection to clipboard | `yank_main_selection_to_clipboard` |
246| `Y` | Yank main selection to clipboard | `yank_main_selection_to_clipboard` |
243| `R` | Replace selections by clipboard contents | `replace_selections_with_clipboard` |
247| `R` | Replace selections by clipboard contents | `replace_selections_with_clipboard` |
244| `/` | Global search in workspace folder | `global_search` |
248| `/` | Global search in workspace folder | `global_search` |
249+| `?` | Open command palette | `command_palette` |
245
250
246> TIP: Global search displays results in a fuzzy picker, use `space + '` to bring it back up after opening a file.
251> TIP: Global search displays results in a fuzzy picker, use `space + '` to bring it back up after opening a file.
247
252
@@ -277,33 +282,48 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire
277
282
278## Insert Mode
283## Insert Mode
279
284
285+We support many readline/emacs style bindings in insert mode for
286+convenience. These can be helpful for making simple modifications
287+without escaping to normal mode, but beware that you will not have an
288+undo-able "save point" until you return to normal mode.
289+
280−| Key | Description | Command |
290+| Key | Description | Command |
281−| ----- | ----------- | ------- |
291+| ----- | ----------- | ------- |
282−| `Escape` | Switch to normal mode | `normal_mode` |
292+| `Escape` | Switch to normal mode | `normal_mode` |
283−| `Ctrl-x` | Autocomplete | `completion` |
293+| `Ctrl-x` | Autocomplete | `completion` |
284−| `Ctrl-r` | Insert a register content | `insert_register` |
294+| `Ctrl-r` | Insert a register content | `insert_register` |
285−| `Ctrl-w` | Delete previous word | `delete_word_backward` |
295+| `Ctrl-w`, `Alt-Backspace` | Delete previous word | `delete_word_backward` |
286−| `Alt-d` | Delete next word | `delete_word_forward` |
296+| `Alt-d` | Delete next word | `delete_word_forward` |
287−| `Alt-b`, `Alt-Left` | Backward a word | `move_prev_word_end` |
297+| `Alt-b`, `Alt-Left` | Backward a word | `move_prev_word_end` |
288−| `Ctrl-b`, `Left` | Backward a char | `move_char_left` |
298+| `Ctrl-b`, `Left` | Backward a char | `move_char_left` |
289−| `Alt-f`, `Alt-Right` | Forward a word | `move_next_word_start` |
299+| `Alt-f`, `Alt-Right` | Forward a word | `move_next_word_start` |
290−| `Ctrl-f`, `Right` | Forward a char | `move_char_right` |
300+| `Ctrl-f`, `Right` | Forward a char | `move_char_right` |
291−| `Ctrl-e`, `End` | move to line end | `goto_line_end_newline` |
301+| `Ctrl-e`, `End` | Move to line end | `goto_line_end_newline` |
292−| `Ctrl-a`, `Home` | move to line start | `goto_line_start` |
302+| `Ctrl-a`, `Home` | Move to line start | `goto_line_start` |
293−| `Ctrl-u` | delete to start of line | `kill_to_line_start` |
303+| `Ctrl-u` | Delete to start of line | `kill_to_line_start` |
294−| `Ctrl-k` | delete to end of line | `kill_to_line_end` |
304+| `Ctrl-k` | Delete to end of line | `kill_to_line_end` |
305+| `Ctrl-j`, `Enter` | Insert new line | `insert_newline` |
295−| `backspace`, `Ctrl-h` | delete previous char | `delete_char_backward` |
306+| `Backspace`, `Ctrl-h` | Delete previous char | `delete_char_backward` |
296−| `delete`, `Ctrl-d` | delete previous char | `delete_char_forward` |
307+| `Delete`, `Ctrl-d` | Delete previous char | `delete_char_forward` |
297−| `Ctrl-p`, `Up` | move to previous line | `move_line_up` |
308+| `Ctrl-p`, `Up` | Move to previous line | `move_line_up` |
298−| `Ctrl-n`, `Down` | move to next line | `move_line_down` |
309+| `Ctrl-n`, `Down` | Move to next line | `move_line_down` |
310+| `PageUp` | Move one page up | `page_up` |
311+| `PageDown` | Move one page down | `page_down` |
312+| `Alt->` | Go to end of buffer | `goto_file_end` |
313+| `Alt-<` | Go to start of buffer | `goto_file_start` |
299
314
300## Select / extend mode
315## Select / extend mode
301
316
302−I'm still pondering whether to keep this mode or not. It changes movement
317+This mode echoes Normal mode, but changes any movements to extend
303−commands (including goto) to extend the existing selection instead of replacing it.
318+selections rather than replace them. Goto motions are also changed to
319+extend, so that `vgl` for example extends the selection to the end of
320+the line.
304
321
305−> NOTE: It's a bit confusing at the moment because extend hasn't been
322+Search is also affected. By default, `n` and `N` will remove the current
306−> implemented for all movement commands yet.
323+selection and select the next instance of the search term. Toggling this
324+mode before pressing `n` or `N` makes it possible to keep the current
325+selection. Toggling it on and off during your iterative searching allows
326+you to selectively add search terms to your selections.
307
327
308# Picker
328# Picker
309
329