Skip to content

Automatically generate book documentation of all commands #3840

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 25 commits into from
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
61d6899
Generate markdown table of all static commands
A-Walrus Sep 11, 2022
f7d97fa
Improve command list
A-Walrus Sep 13, 2022
5695600
Remove "&" from static_command items
A-Walrus Sep 14, 2022
c3f5542
Switch to table per mode, similiar to handmade
A-Walrus Sep 14, 2022
e4a5d2d
Add TS/LSP/DAP markings
A-Walrus Sep 14, 2022
505299a
Move all-commands to keymap, replacing original
A-Walrus Sep 14, 2022
2b72005
Add section for unmapped commands
A-Walrus Sep 14, 2022
87ecd9f
Only show differences from Select mode to Normal
A-Walrus Sep 14, 2022
f630bc5
Add table of contents
A-Walrus Sep 14, 2022
0eba3af
Ignore duplicate modes
A-Walrus Sep 14, 2022
b09ceef
move TOC to start
A-Walrus Sep 14, 2022
7c6004f
Distinguish between sticky and non-sticky
A-Walrus Sep 14, 2022
746b60a
Add descriptions to modes
A-Walrus Sep 14, 2022
39b9aae
Add back changes from #3827
A-Walrus Sep 14, 2022
ee44c0f
Add category field to commands
A-Walrus Sep 14, 2022
cf35344
Fix regression with keymap code
A-Walrus Sep 14, 2022
2e1b540
Cleanup
A-Walrus Sep 14, 2022
26cda9b
Add categories
A-Walrus Sep 15, 2022
6d9c18a
Fix clippy lints
A-Walrus Sep 15, 2022
5527aa6
Add note about vim-unimpaired
A-Walrus Sep 15, 2022
1289ed8
Rename Category::None to Category::Other
A-Walrus Sep 16, 2022
c19eaf1
Align collumns in static_commands!
A-Walrus Sep 16, 2022
8665923
Replace ifs with version from poliorcetics
A-Walrus Sep 16, 2022
86fe63f
Add hard-coded prompt and picker sections
A-Walrus Sep 16, 2022
0bf820d
Sort static_commands by category
A-Walrus Sep 16, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

473 changes: 473 additions & 0 deletions book/src/generated/keymap.md

Large diffs are not rendered by default.

421 changes: 5 additions & 416 deletions book/src/keymap.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions book/src/keymap/modes/goto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Jumps to various locations.
38 changes: 38 additions & 0 deletions book/src/keymap/modes/insert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Insert mode bindings are somewhat minimal by default. Helix is designed to
be a modal editor, and this is reflected in the user experience and internal
mechanics. For example, changes to the text are only saved for undos when
escaping from insert mode to normal mode. For this reason, new users are
strongly encouraged to learn the modal editing paradigm to get the smoothest
experience.






However, if you really want navigation in insert mode, this is supported. An
example config that gives the ability to use arrow keys while still in insert
mode:

```toml
[keys.insert]
"up" = "move_line_up"
"down" = "move_line_down"
"left" = "move_char_left"
"right" = "move_char_right"
"C-b" = "move_char_left"
"C-f" = "move_char_right"
"A-b" = "move_prev_word_end"
"C-left" = "move_prev_word_end"
"A-f" = "move_next_word_start"
"C-right" = "move_next_word_start"
"A-<" = "goto_file_start"
"A->" = "goto_file_end"
"pageup" = "page_up"
"pagedown" = "page_down"
"home" = "goto_line_start"
"C-a" = "goto_line_start"
"end" = "goto_line_end_newline"
"C-e" = "goto_line_end_newline"
"A-left" = "goto_line_start"
```
1 change: 1 addition & 0 deletions book/src/keymap/modes/left_bracket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired).
7 changes: 7 additions & 0 deletions book/src/keymap/modes/match.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Enter this mode using `m` from normal mode. See the relevant section
in [Usage](./usage.md) for an explanation about [surround](./usage.md#surround)
and [textobject](./usage.md#textobject) usage.



TODO: Mappings for selecting syntax nodes (a superset of `[`).
1 change: 1 addition & 0 deletions book/src/keymap/modes/minor_modes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
These sub-modes are accessible from normal mode and typically switch back to normal mode after a command.
1 change: 1 addition & 0 deletions book/src/keymap/modes/movement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> NOTE: Unlike Vim, `f`, `F`, `t` and `T` are not confined to the current line.
1 change: 1 addition & 0 deletions book/src/keymap/modes/right_bracket.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaired).
1 change: 1 addition & 0 deletions book/src/keymap/modes/search.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Search commands all operate on the `/` register by default. Use `"<char>` to operate on a different one.
10 changes: 10 additions & 0 deletions book/src/keymap/modes/select.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
This mode echoes Normal mode, but changes any movements to extend
selections rather than replace them. Goto motions are also changed to
extend, so that `vgl` for example extends the selection to the end of
the line.

Search is also affected. By default, `n` and `N` will remove the current
selection and select the next instance of the search term. Toggling this
mode before pressing `n` or `N` makes it possible to keep the current
selection. Toggling it on and off during your iterative searching allows
you to selectively add search terms to your selections.
6 changes: 6 additions & 0 deletions book/src/keymap/modes/space.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This layer is a kludge of mappings, mostly pickers.




> TIP: Global search displays results in a fuzzy picker, use `space + '` to bring it back up after opening a file.
5 changes: 5 additions & 0 deletions book/src/keymap/modes/unmapped_commands.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Some commands exist but do not have a default keybinding. These commands
may be quite niche, or simply alternatives to the standard commands. If you
want to use them, simply map them in your configuration (see [remapping]).

[remapping]: ./remapping.md
4 changes: 4 additions & 0 deletions book/src/keymap/modes/view.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
View mode is intended for scrolling and manipulating the view without changing
the selection. The "sticky" variant of this mode is persistent; use the
`Escape` key to return to normal mode after usage (useful when you're simply
looking over text and not actively editing it).
1 change: 1 addition & 0 deletions book/src/keymap/modes/window.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This layer is similar to Vim keybindings as Kakoune does not support window.
16 changes: 16 additions & 0 deletions book/src/keymap/picker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Keys to use within picker. Remapping currently not supported.

| Key | Description |
| ----- | ------------- |
| `Tab`, `Up`, `Ctrl-p` | Previous entry |
| `PageUp`, `Ctrl-u` | Page up |
| `Shift-tab`, `Down`, `Ctrl-n`| Next entry |
| `PageDown`, `Ctrl-d` | Page down |
| `Home` | Go to first entry |
| `End` | Go to last entry |
| `Ctrl-space` | Filter options |
| `Enter` | Open selected |
| `Ctrl-s` | Open horizontally |
| `Ctrl-v` | Open vertically |
| `Ctrl-t` | Toggle preview |
| `Escape`, `Ctrl-c` | Close picker |
24 changes: 24 additions & 0 deletions book/src/keymap/prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Keys to use within prompt, Remapping currently not supported.

| Key | Description |
| ----- | ------------- |
| `Escape`, `Ctrl-c` | Close prompt |
| `Alt-b`, `Ctrl-Left` | Backward a word |
| `Ctrl-b`, `Left` | Backward a char |
| `Alt-f`, `Ctrl-Right` | Forward a word |
| `Ctrl-f`, `Right` | Forward a char |
| `Ctrl-e`, `End` | Move prompt end |
| `Ctrl-a`, `Home` | Move prompt start |
| `Ctrl-w`, `Alt-Backspace`, `Ctrl-Backspace` | Delete previous word |
| `Alt-d`, `Alt-Delete`, `Ctrl-Delete` | 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 next 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 |
| `Ctrl-r` | Insert the content of the register selected by following input char |
| `Tab` | Select next completion item |
| `BackTab` | Select previous completion item |
| `Enter` | Open selected |
2 changes: 1 addition & 1 deletion book/src/remapping.md
Original file line number Diff line number Diff line change
@@ -50,5 +50,5 @@ Control, Shift and Alt modifiers are encoded respectively with the prefixes

Keys can be disabled by binding them to the `no_op` command.

Commands can be found at [Keymap](https://docs.helix-editor.com/keymap.html) Commands.
Commands can be found at [Keymap](./keymap.md) Commands.
> Commands can also be found in the source code at [`helix-term/src/commands.rs`](https://github.com/helix-editor/helix/blob/master/helix-term/src/commands.rs) at the invocation of `static_commands!` macro and the `TypableCommandList`.
Loading