aboutsummaryrefslogtreecommitdiff
path: root/book/src/keymap.md
diff options
context:
space:
mode:
Diffstat (limited to 'book/src/keymap.md')
-rw-r--r--book/src/keymap.md162
1 files changed, 101 insertions, 61 deletions
diff --git a/book/src/keymap.md b/book/src/keymap.md
index 5a6aee41..c88ed767 100644
--- a/book/src/keymap.md
+++ b/book/src/keymap.md
@@ -1,5 +1,8 @@
# Keymap
+- Mappings marked (**LSP**) require an active language server for the file.
+- Mappings marked (**TS**) require a tree-sitter grammar for the filetype.
+
## Normal mode
### Movement
@@ -58,15 +61,19 @@
| `.` | Repeat last change | N/A |
| `u` | Undo change | `undo` |
| `U` | Redo change | `redo` |
+| `Alt-u` | Move backward in history | `earlier` |
+| `Alt-U` | Move forward in history | `later` |
| `y` | Yank selection | `yank` |
| `p` | Paste after selection | `paste_after` |
| `P` | Paste before selection | `paste_before` |
| `"` `<reg>` | Select a register to yank to or paste from | `select_register` |
| `>` | Indent selection | `indent` |
| `<` | Unindent selection | `unindent` |
-| `=` | Format selection | `format_selections` |
+| `=` | Format selection (**LSP**) | `format_selections` |
| `d` | Delete selection | `delete_selection` |
| `c` | Change selection (delete and enter insert mode) | `change_selection` |
+| `Ctrl-a` | Increment object (number) under cursor | `increment` |
+| `Ctrl-x` | Decrement object (number) under cursor | `decrement` |
#### Shell
@@ -85,6 +92,7 @@
| `s` | Select all regex matches inside selections | `select_regex` |
| `S` | Split selection into subselections on regex matches | `split_selection` |
| `Alt-s` | Split selection on newlines | `split_selection_on_newline` |
+| `_` | Trim whitespace from the selection | `trim_selections` |
| `;` | Collapse selection onto a single cursor | `collapse_selection` |
| `Alt-;` | Flip selection cursor and anchor | `flip_selections` |
| `,` | Keep only the primary selection | `keep_primary_selection` |
@@ -98,9 +106,10 @@
| `%` | Select entire file | `select_all` |
| `x` | Select current line, if already selected, extend to next line | `extend_line` |
| `X` | Extend selection to line bounds (line-wise selection) | `extend_to_line_bounds` |
-| | Expand selection to parent syntax node TODO: pick a key | `expand_selection` |
+| | Expand selection to parent syntax node TODO: pick a key (**TS**) | `expand_selection` |
| `J` | Join lines inside selection | `join_selections` |
| `K` | Keep selections matching the regex | `keep_selections` |
+| `Alt-K` | Remove selections matching the regex | `remove_selections` |
| `$` | Pipe each selection into shell command, keep selections where command returned 0 | `shell_keep_pipe` |
| `Ctrl-c` | Comment/uncomment the selections | `toggle_comments` |
@@ -127,25 +136,23 @@ key to return to normal mode after usage (useful when you're simply looking
over text and not actively editing it).
-| Key | Description | Command |
-| ----- | ----------- | ------- |
-| `z` , `c` | Vertically center the line | `align_view_center` |
-| `t` | Align the line to the top of the screen | `align_view_top` |
-| `b` | Align the line to the bottom of the screen | `align_view_bottom` |
-| `m` | Align the line to the middle of the screen (horizontally) | `align_view_middle` |
-| `j` | Scroll the view downwards | `scroll_down` |
-| `k` | Scroll the view upwards | `scroll_up` |
-| `f` | Move page down | `page_down` |
-| `b` | Move page up | `page_up` |
-| `d` | Move half page down | `half_page_down` |
-| `u` | Move half page up | `half_page_up` |
+| Key | Description | Command |
+| ----- | ----------- | ------- |
+| `z` , `c` | Vertically center the line | `align_view_center` |
+| `t` | Align the line to the top of the screen | `align_view_top` |
+| `b` | Align the line to the bottom of the screen | `align_view_bottom` |
+| `m` | Align the line to the middle of the screen (horizontally) | `align_view_middle` |
+| `j` , `down` | Scroll the view downwards | `scroll_down` |
+| `k` , `up` | Scroll the view upwards | `scroll_up` |
+| `f` | Move page down | `page_down` |
+| `b` | Move page up | `page_up` |
+| `d` | Move half page down | `half_page_down` |
+| `u` | Move half page up | `half_page_up` |
#### Goto mode
Jumps to various locations.
-> NOTE: Some of these features are only available with the LSP present.
-
| Key | Description | Command |
| ----- | ----------- | ------- |
| `g` | Go to the start of the file | `goto_file_start` |
@@ -156,13 +163,14 @@ Jumps to various locations.
| `t` | Go to the top of the screen | `goto_window_top` |
| `m` | Go to the middle of the screen | `goto_window_middle` |
| `b` | Go to the bottom of the screen | `goto_window_bottom` |
-| `d` | Go to definition | `goto_definition` |
-| `y` | Go to type definition | `goto_type_definition` |
-| `r` | Go to references | `goto_reference` |
-| `i` | Go to implementation | `goto_implementation` |
+| `d` | Go to definition (**LSP**) | `goto_definition` |
+| `y` | Go to type definition (**LSP**) | `goto_type_definition` |
+| `r` | Go to references (**LSP**) | `goto_reference` |
+| `i` | Go to implementation (**LSP**) | `goto_implementation` |
| `a` | Go to the last accessed/alternate file | `goto_last_accessed_file` |
| `n` | Go to next buffer | `goto_next_buffer` |
| `p` | Go to previous buffer | `goto_previous_buffer` |
+| `.` | Go to last modification in current file | `goto_last_modification` |
#### Match mode
@@ -172,7 +180,7 @@ and [textobject](./usage.md#textobject) usage.
| Key | Description | Command |
| ----- | ----------- | ------- |
-| `m` | Goto matching bracket | `match_brackets` |
+| `m` | Goto matching bracket (**TS**) | `match_brackets` |
| `s` `<char>` | Surround current selection with `<char>` | `surround_add` |
| `r` `<from><to>` | Replace surround character `<from>` with `<to>` | `surround_replace` |
| `d` `<char>` | Delete surround character `<char>` | `surround_delete` |
@@ -195,49 +203,76 @@ This layer is similar to vim keybindings as kakoune does not support window.
| `k`, `Ctrl-k`, `up` | Move to split above | `jump_view_up` |
| `l`, `Ctrl-l`, `right` | Move to right split | `jump_view_right` |
| `q`, `Ctrl-q` | Close current window | `wclose` |
+| `o`, `Ctrl-o` | Only keep the current window, closing all the others | `wonly` |
#### Space mode
This layer is a kludge of mappings, mostly pickers.
-| Key | Description | Command |
-| ----- | ----------- | ------- |
-| `k` | Show documentation for the item under the cursor | `hover` |
-| `f` | Open file picker | `file_picker` |
-| `b` | Open buffer picker | `buffer_picker` |
-| `s` | Open symbol picker (current document) | `symbol_picker` |
-| `a` | Apply code action | `code_action` |
-| `'` | Open last fuzzy picker | `last_picker` |
-| `w` | Enter [window mode](#window-mode) | N/A |
-| `p` | Paste system clipboard after selections | `paste_clipboard_after` |
-| `P` | Paste system clipboard before selections | `paste_clipboard_before` |
-| `y` | Join and yank selections to clipboard | `yank_joined_to_clipboard` |
-| `Y` | Yank main selection to clipboard | `yank_main_selection_to_clipboard` |
-| `R` | Replace selections by clipboard contents | `replace_selections_with_clipboard` |
-| `/` | Global search in workspace folder | `global_search` |
-
-> NOTE: Global search display results in a fuzzy picker, use `space + '` to bring it back up after opening a file.
+
+| Key | Description | Command |
+| ----- | ----------- | ------- |
+| `f` | Open file picker | `file_picker` |
+| `b` | Open buffer picker | `buffer_picker` |
+| `k` | Show documentation for item under cursor in a [popup](#popup) (**LSP**) | `hover` |
+| `s` | Open document symbol picker (**LSP**) | `symbol_picker` |
+| `S` | Open workspace symbol picker (**LSP**) | `workspace_symbol_picker` |
+| `r` | Rename symbol (**LSP**) | `rename_symbol` |
+| `a` | Apply code action (**LSP**) | `code_action` |
+| `'` | Open last fuzzy picker | `last_picker` |
+| `w` | Enter [window mode](#window-mode) | N/A |
+| `p` | Paste system clipboard after selections | `paste_clipboard_after` |
+| `P` | Paste system clipboard before selections | `paste_clipboard_before` |
+| `y` | Join and yank selections to clipboard | `yank_joined_to_clipboard` |
+| `Y` | Yank main selection to clipboard | `yank_main_selection_to_clipboard` |
+| `R` | Replace selections by clipboard contents | `replace_selections_with_clipboard` |
+| `/` | Global search in workspace folder | `global_search` |
+
+> TIP: Global search displays results in a fuzzy picker, use `space + '` to bring it back up after opening a file.
+
+##### Popup
+
+Displays documentation for item under cursor.
+
+| Key | Description |
+| ---- | ----------- |
+| `Ctrl-u` | Scroll up |
+| `Ctrl-d` | Scroll down |
#### Unimpaired
Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired).
-| Key | Description | Command |
-| ----- | ----------- | ------- |
-| `[d` | Go to previous diagnostic | `goto_prev_diag` |
-| `]d` | Go to next diagnostic | `goto_next_diag` |
-| `[D` | Go to first diagnostic in document | `goto_first_diag` |
-| `]D` | Go to last diagnostic in document | `goto_last_diag` |
-| `[space` | Add newline above | `add_newline_above` |
-| `]space` | Add newline below | `add_newline_below` |
+| Key | Description | Command |
+| ----- | ----------- | ------- |
+| `[d` | Go to previous diagnostic (**LSP**) | `goto_prev_diag` |
+| `]d` | Go to next diagnostic (**LSP**) | `goto_next_diag` |
+| `[D` | Go to first diagnostic in document (**LSP**) | `goto_first_diag` |
+| `]D` | Go to last diagnostic in document (**LSP**) | `goto_last_diag` |
+| `[space` | Add newline above | `add_newline_above` |
+| `]space` | Add newline below | `add_newline_below` |
## Insert Mode
-| Key | Description | Command |
-| ----- | ----------- | ------- |
-| `Escape` | Switch to normal mode | `normal_mode` |
-| `Ctrl-x` | Autocomplete | `completion` |
-| `Ctrl-w` | Delete previous word | `delete_word_backward` |
+| Key | Description | Command |
+| ----- | ----------- | ------- |
+| `Escape` | Switch to normal mode | `normal_mode` |
+| `Ctrl-x` | Autocomplete | `completion` |
+| `Ctrl-r` | Insert a register content | `insert_register` |
+| `Ctrl-w` | Delete previous word | `delete_word_backward` |
+| `Alt-d` | Delete next word | `delete_word_forward` |
+| `Alt-b`, `Alt-Left` | Backward a word | `move_prev_word_end` |
+| `Ctrl-b`, `Left` | Backward a char | `move_char_left` |
+| `Alt-f`, `Alt-Right` | Forward a word | `move_next_word_start` |
+| `Ctrl-f`, `Right` | Forward a char | `move_char_right` |
+| `Ctrl-e`, `End` | move to line end | `goto_line_end_newline` |
+| `Ctrl-a`, `Home` | move to line start | `goto_line_start` |
+| `Ctrl-u` | delete to start of line | `kill_to_line_start` |
+| `Ctrl-k` | delete to end of line | `kill_to_line_end` |
+| `backspace`, `Ctrl-h` | delete previous char | `delete_char_backward` |
+| `delete`, `Ctrl-d` | delete previous char | `delete_char_forward` |
+| `Ctrl-p`, `Up` | move to previous line | `move_line_up` |
+| `Ctrl-n`, `Down` | move to next line | `move_line_down` |
## Select / extend mode
@@ -262,7 +297,9 @@ Keys to use within picker. Remapping currently not supported.
| `Escape`, `Ctrl-c` | Close picker |
# Prompt
+
Keys to use within prompt, Remapping currently not supported.
+
| Key | Description |
| ----- | ------------- |
| `Escape`, `Ctrl-c` | Close prompt |
@@ -270,15 +307,18 @@ Keys to use within prompt, Remapping currently not supported.
| `Ctrl-b`, `Left` | Backward a char |
| `Alt-f`, `Alt-Right` | Forward a word |
| `Ctrl-f`, `Right` | Forward a char |
-| `Ctrl-e`, `End` | move prompt end |
-| `Ctrl-a`, `Home` | move prompt start |
-| `Ctrl-w` | delete previous word |
-| `Ctrl-k` | delete to end of line |
-| `backspace` | delete previous char |
-| `Ctrl-s` | insert a word under doc cursor, may be changed to Ctrl-r Ctrl-w later |
-| `Ctrl-p`, `Up` | select previous history |
-| `Ctrl-n`, `Down` | select next history |
-| `Tab` | slect next completion item |
-| `BackTab` | slect previous completion item |
+| `Ctrl-e`, `End` | Move prompt end |
+| `Ctrl-a`, `Home` | Move prompt start |
+| `Ctrl-w` | Delete previous word |
+| `Alt-d` | Delete next word |
+| `Ctrl-u` | Delete to start of line |
+| `Ctrl-k` | Delete to end of line |
+| `backspace`, `Ctrl-h` | Delete previous char |
+| `delete`, `Ctrl-d` | Delete previous char |
+| `Ctrl-s` | Insert a word under doc cursor, may be changed to Ctrl-r Ctrl-w later |
+| `Ctrl-p`, `Up` | Select previous history |
+| `Ctrl-n`, `Down` | Select next history |
+| `Tab` | Select next completion item |
+| `BackTab` | Select previous completion item |
| `Enter` | Open selected |