diff --git a/book/src/commands.md b/book/src/commands.md index 1b001725c..b029c3b56 100644 --- a/book/src/commands.md +++ b/book/src/commands.md @@ -1,4 +1,4 @@ -## Commands +# Commands - [Typable commands](#typable-commands) - [Static commands](#static-commands) diff --git a/book/src/generated/static-cmd.md b/book/src/generated/static-cmd.md index bc55a195a..127c7c4ae 100644 --- a/book/src/generated/static-cmd.md +++ b/book/src/generated/static-cmd.md @@ -1,18 +1,18 @@ | Name | Description | Default keybinds | | --- | --- | --- | | `no_op` | Do nothing | | -| `move_char_left` | Move left | normal: `` ``, `` h ``, insert: `` `` | +| `move_char_left` | Move left | normal: `` h ``, `` ``, insert: `` `` | | `move_char_right` | Move right | normal: `` l ``, `` ``, insert: `` `` | | `move_line_up` | Move up | normal: `` gk `` | | `move_line_down` | Move down | normal: `` gj `` | | `move_visual_line_up` | Move up | normal: `` k ``, `` ``, insert: `` `` | -| `move_visual_line_down` | Move down | normal: `` ``, `` j ``, insert: `` `` | -| `extend_char_left` | Extend left | select: `` ``, `` h `` | +| `move_visual_line_down` | Move down | normal: `` j ``, `` ``, insert: `` `` | +| `extend_char_left` | Extend left | select: `` h ``, `` `` | | `extend_char_right` | Extend right | select: `` l ``, `` `` | | `extend_line_up` | Extend up | select: `` gk `` | | `extend_line_down` | Extend down | select: `` gj `` | | `extend_visual_line_up` | Extend up | select: `` k ``, `` `` | -| `extend_visual_line_down` | Extend down | select: `` ``, `` j `` | +| `extend_visual_line_down` | Extend down | select: `` j ``, `` `` | | `copy_selection_on_next_line` | Copy selection on next line | normal: `` C ``, select: `` C `` | | `copy_selection_on_prev_line` | Copy selection on previous line | normal: `` ``, select: `` `` | | `move_next_word_start` | Move to start of next word | normal: `` w `` | @@ -56,24 +56,24 @@ | `switch_case` | Switch (toggle) case | normal: `` ~ ``, select: `` ~ `` | | `switch_to_uppercase` | Switch to uppercase | normal: `` ``, select: `` `` | | `switch_to_lowercase` | Switch to lowercase | normal: `` ` ``, select: `` ` `` | -| `page_up` | Move page up | normal: `` ``, `` z ``, `` z ``, `` Z ``, `` Z ``, `` ``, select: `` ``, `` z ``, `` z ``, `` Z ``, `` Z ``, `` ``, insert: `` `` | -| `page_down` | Move page down | normal: `` z ``, `` z ``, `` Z ``, `` Z ``, `` ``, `` ``, select: `` z ``, `` z ``, `` Z ``, `` Z ``, `` ``, `` ``, insert: `` `` | +| `page_up` | Move page up | normal: `` ``, `` ``, `` Z ``, `` Z ``, `` z ``, `` z ``, select: `` ``, `` ``, `` Z ``, `` Z ``, `` z ``, `` z ``, insert: `` `` | +| `page_down` | Move page down | normal: `` ``, `` ``, `` Z ``, `` Z ``, `` z ``, `` z ``, select: `` ``, `` ``, `` Z ``, `` Z ``, `` z ``, `` z ``, insert: `` `` | | `half_page_up` | Move half page up | | | `half_page_down` | Move half page down | | | `page_cursor_up` | Move page and cursor up | | | `page_cursor_down` | Move page and cursor down | | -| `page_cursor_half_up` | Move page and cursor half up | normal: `` z ``, `` z ``, `` Z ``, `` Z ``, `` ``, select: `` z ``, `` z ``, `` Z ``, `` Z ``, `` `` | -| `page_cursor_half_down` | Move page and cursor half down | normal: `` z ``, `` z ``, `` Z ``, `` Z ``, `` ``, select: `` z ``, `` z ``, `` Z ``, `` Z ``, `` `` | +| `page_cursor_half_up` | Move page and cursor half up | normal: `` ``, `` Z ``, `` Z ``, `` z ``, `` z ``, select: `` ``, `` Z ``, `` Z ``, `` z ``, `` z `` | +| `page_cursor_half_down` | Move page and cursor half down | normal: `` ``, `` Z ``, `` Z ``, `` z ``, `` z ``, select: `` ``, `` Z ``, `` Z ``, `` z ``, `` z `` | | `select_all` | Select whole document | normal: `` % ``, select: `` % `` | | `select_regex` | Select all regex matches inside selections | normal: `` s ``, select: `` s `` | | `split_selection` | Split selections on regex matches | normal: `` S ``, select: `` S `` | | `split_selection_on_newline` | Split selection on newlines | normal: `` ``, select: `` `` | | `merge_selections` | Merge selections | normal: `` ``, select: `` `` | | `merge_consecutive_selections` | Merge consecutive selections | normal: `` ``, select: `` `` | -| `search` | Search for regex pattern | normal: `` z/ ``, `` Z/ ``, `` / ``, select: `` z/ ``, `` Z/ ``, `` / `` | -| `rsearch` | Reverse search for regex pattern | normal: `` z? ``, `` Z? ``, `` ? ``, select: `` z? ``, `` Z? ``, `` ? `` | -| `search_next` | Select next search match | normal: `` zn ``, `` Zn ``, `` n ``, select: `` zn ``, `` Zn `` | -| `search_prev` | Select previous search match | normal: `` zN ``, `` N ``, `` ZN ``, select: `` zN ``, `` ZN `` | +| `search` | Search for regex pattern | normal: `` / ``, `` Z/ ``, `` z/ ``, select: `` / ``, `` Z/ ``, `` z/ `` | +| `rsearch` | Reverse search for regex pattern | normal: `` ? ``, `` Z? ``, `` z? ``, select: `` ? ``, `` Z? ``, `` z? `` | +| `search_next` | Select next search match | normal: `` Zn ``, `` n ``, `` zn ``, select: `` Zn ``, `` zn `` | +| `search_prev` | Select previous search match | normal: `` N ``, `` ZN ``, `` zN ``, select: `` ZN ``, `` zN `` | | `extend_search_next` | Add next search match to selection | select: `` n `` | | `extend_search_prev` | Add previous search match to selection | select: `` N `` | | `search_selection` | Use current selection as search pattern | normal: `` * ``, select: `` * `` | @@ -144,8 +144,8 @@ | `goto_prev_change` | Goto previous change | normal: `` [g ``, select: `` [g `` | | `goto_first_change` | Goto first change | normal: `` [G ``, select: `` [G `` | | `goto_last_change` | Goto last change | normal: `` ]G ``, select: `` ]G `` | -| `goto_line_start` | Goto line start | normal: `` ``, `` gh ``, select: `` gh ``, insert: `` `` | -| `goto_line_end` | Goto line end | normal: `` ``, `` gl ``, select: `` gl `` | +| `goto_line_start` | Goto line start | normal: `` gh ``, `` ``, select: `` gh ``, insert: `` `` | +| `goto_line_end` | Goto line end | normal: `` gl ``, `` ``, select: `` gl `` | | `goto_next_buffer` | Goto next buffer | normal: `` gn ``, select: `` gn `` | | `goto_previous_buffer` | Goto previous buffer | normal: `` gp ``, select: `` gp `` | | `goto_line_end_newline` | Goto newline at line end | insert: `` `` | @@ -158,10 +158,10 @@ | `signature_help` | Show signature help | | | `smart_tab` | Insert tab if all cursors have all whitespace to their left; otherwise, run a separate command. | insert: `` `` | | `insert_tab` | Insert tab char | insert: `` `` | -| `insert_newline` | Insert newline char | insert: `` ``, `` `` | -| `delete_char_backward` | Delete previous char | insert: `` ``, `` ``, `` `` | -| `delete_char_forward` | Delete next char | insert: `` ``, `` `` | -| `delete_word_backward` | Delete previous word | insert: `` ``, `` `` | +| `insert_newline` | Insert newline char | insert: `` ``, `` `` | +| `delete_char_backward` | Delete previous char | insert: `` ``, `` ``, `` `` | +| `delete_char_forward` | Delete next char | insert: `` ``, `` `` | +| `delete_word_backward` | Delete previous word | insert: `` ``, `` `` | | `delete_word_forward` | Delete next word | insert: `` ``, `` `` | | `kill_to_line_start` | Delete till start of line | insert: `` `` | | `kill_to_line_end` | Delete till end of line | insert: `` `` | @@ -210,37 +210,37 @@ | `expand_selection` | Expand selection to parent syntax node | normal: `` ``, `` ``, select: `` ``, `` `` | | `shrink_selection` | Shrink selection to previously expanded syntax node | normal: `` ``, `` ``, select: `` ``, `` `` | | `select_next_sibling` | Select next sibling in the syntax tree | normal: `` ``, `` ``, select: `` ``, `` `` | -| `select_prev_sibling` | Select previous sibling the in syntax tree | normal: `` ``, `` ``, select: `` ``, `` `` | +| `select_prev_sibling` | Select previous sibling the in syntax tree | normal: `` ``, `` ``, select: `` ``, `` `` | | `select_all_siblings` | Select all siblings of the current node | normal: `` ``, select: `` `` | -| `select_all_children` | Select all children of the current node | normal: `` ``, `` ``, select: `` ``, `` `` | -| `jump_forward` | Jump forward on jumplist | normal: `` ``, `` ``, select: `` ``, `` `` | +| `select_all_children` | Select all children of the current node | normal: `` ``, `` ``, select: `` ``, `` `` | +| `jump_forward` | Jump forward on jumplist | normal: `` ``, `` ``, select: `` ``, `` `` | | `jump_backward` | Jump backward on jumplist | normal: `` ``, select: `` `` | | `save_selection` | Save current selection to jumplist | normal: `` ``, select: `` `` | -| `jump_view_right` | Jump to right split | normal: `` ``, `` l ``, `` ``, `` wl ``, `` w ``, `` w ``, select: `` ``, `` l ``, `` ``, `` wl ``, `` w ``, `` w `` | -| `jump_view_left` | Jump to left split | normal: `` ``, `` h ``, `` ``, `` wh ``, `` w ``, `` w ``, select: `` ``, `` h ``, `` ``, `` wh ``, `` w ``, `` w `` | -| `jump_view_up` | Jump to split above | normal: `` ``, `` k ``, `` ``, `` w ``, `` w ``, `` wk ``, select: `` ``, `` k ``, `` ``, `` w ``, `` w ``, `` wk `` | -| `jump_view_down` | Jump to split below | normal: `` ``, `` ``, `` j ``, `` wj ``, `` w ``, `` w ``, select: `` ``, `` ``, `` j ``, `` wj ``, `` w ``, `` w `` | +| `jump_view_right` | Jump to right split | normal: `` ``, `` ``, `` l ``, `` w ``, `` w ``, `` wl ``, select: `` ``, `` ``, `` l ``, `` w ``, `` w ``, `` wl `` | +| `jump_view_left` | Jump to left split | normal: `` ``, `` ``, `` h ``, `` w ``, `` w ``, `` wh ``, select: `` ``, `` ``, `` h ``, `` w ``, `` w ``, `` wh `` | +| `jump_view_up` | Jump to split above | normal: `` ``, `` ``, `` k ``, `` w ``, `` w ``, `` wk ``, select: `` ``, `` ``, `` k ``, `` w ``, `` w ``, `` wk `` | +| `jump_view_down` | Jump to split below | normal: `` ``, `` ``, `` j ``, `` w ``, `` w ``, `` wj ``, select: `` ``, `` ``, `` j ``, `` w ``, `` w ``, `` wj `` | | `swap_view_right` | Swap with right split | normal: `` L ``, `` wL ``, select: `` L ``, `` wL `` | | `swap_view_left` | Swap with left split | normal: `` H ``, `` wH ``, select: `` H ``, `` wH `` | | `swap_view_up` | Swap with split above | normal: `` K ``, `` wK ``, select: `` K ``, `` wK `` | | `swap_view_down` | Swap with split below | normal: `` J ``, `` wJ ``, select: `` J ``, `` wJ `` | -| `transpose_view` | Transpose splits | normal: `` ``, `` t ``, `` wt ``, `` w ``, select: `` ``, `` t ``, `` wt ``, `` w `` | -| `rotate_view` | Goto next window | normal: `` w ``, `` ``, `` ww ``, `` w ``, select: `` w ``, `` ``, `` ww ``, `` w `` | +| `transpose_view` | Transpose splits | normal: `` ``, `` t ``, `` w ``, `` wt ``, select: `` ``, `` t ``, `` w ``, `` wt `` | +| `rotate_view` | Goto next window | normal: `` ``, `` w ``, `` w ``, `` ww ``, select: `` ``, `` w ``, `` w ``, `` ww `` | | `rotate_view_reverse` | Goto previous window | | -| `hsplit` | Horizontal bottom split | normal: `` s ``, `` ``, `` ws ``, `` w ``, select: `` s ``, `` ``, `` ws ``, `` w `` | +| `hsplit` | Horizontal bottom split | normal: `` ``, `` s ``, `` w ``, `` ws ``, select: `` ``, `` s ``, `` w ``, `` ws `` | | `hsplit_new` | Horizontal bottom split scratch buffer | normal: `` n ``, `` ns ``, `` wn ``, `` wns ``, select: `` n ``, `` ns ``, `` wn ``, `` wns `` | -| `vsplit` | Vertical right split | normal: `` ``, `` v ``, `` wv ``, `` w ``, select: `` ``, `` v ``, `` wv ``, `` w `` | -| `vsplit_new` | Vertical right split scratch buffer | normal: `` n ``, `` nv ``, `` wnv ``, `` wn ``, select: `` n ``, `` nv ``, `` wnv ``, `` wn `` | +| `vsplit` | Vertical right split | normal: `` ``, `` v ``, `` w ``, `` wv ``, select: `` ``, `` v ``, `` w ``, `` wv `` | +| `vsplit_new` | Vertical right split scratch buffer | normal: `` n ``, `` nv ``, `` wn ``, `` wnv ``, select: `` n ``, `` nv ``, `` wn ``, `` wnv `` | | `wclose` | Close window | normal: `` ``, `` q ``, `` w ``, `` wq ``, select: `` ``, `` q ``, `` w ``, `` wq `` | | `wonly` | Close windows except current | normal: `` ``, `` o ``, `` w ``, `` wo ``, select: `` ``, `` o ``, `` w ``, `` wo `` | | `select_register` | Select register | normal: `` " ``, select: `` " `` | | `insert_register` | Insert register | insert: `` `` | -| `align_view_middle` | Align view middle | normal: `` zm ``, `` Zm ``, select: `` zm ``, `` Zm `` | -| `align_view_top` | Align view top | normal: `` zt ``, `` Zt ``, select: `` zt ``, `` Zt `` | -| `align_view_center` | Align view center | normal: `` zc ``, `` zz ``, `` Zz ``, `` Zc ``, select: `` zc ``, `` zz ``, `` Zz ``, `` Zc `` | -| `align_view_bottom` | Align view bottom | normal: `` zb ``, `` Zb ``, select: `` zb ``, `` Zb `` | -| `scroll_up` | Scroll view up | normal: `` zk ``, `` z ``, `` Z ``, `` Zk ``, select: `` zk ``, `` z ``, `` Z ``, `` Zk `` | -| `scroll_down` | Scroll view down | normal: `` zj ``, `` z ``, `` Z ``, `` Zj ``, select: `` zj ``, `` z ``, `` Z ``, `` Zj `` | +| `align_view_middle` | Align view middle | normal: `` Zm ``, `` zm ``, select: `` Zm ``, `` zm `` | +| `align_view_top` | Align view top | normal: `` Zt ``, `` zt ``, select: `` Zt ``, `` zt `` | +| `align_view_center` | Align view center | normal: `` Zc ``, `` Zz ``, `` zc ``, `` zz ``, select: `` Zc ``, `` Zz ``, `` zc ``, `` zz `` | +| `align_view_bottom` | Align view bottom | normal: `` Zb ``, `` zb ``, select: `` Zb ``, `` zb `` | +| `scroll_up` | Scroll view up | normal: `` Zk ``, `` zk ``, `` Z ``, `` z ``, select: `` Zk ``, `` zk ``, `` Z ``, `` z `` | +| `scroll_down` | Scroll view down | normal: `` Zj ``, `` zj ``, `` Z ``, `` z ``, select: `` Zj ``, `` zj ``, `` Z ``, `` z `` | | `match_brackets` | Goto matching bracket | normal: `` mm ``, select: `` mm `` | | `surround_add` | Surround add | normal: `` ms ``, select: `` ms `` | | `surround_replace` | Surround replace | normal: `` mr ``, select: `` mr `` | diff --git a/xtask/src/docgen.rs b/xtask/src/docgen.rs index a52c1165d..f07e8c14e 100644 --- a/xtask/src/docgen.rs +++ b/xtask/src/docgen.rs @@ -76,17 +76,19 @@ pub fn static_commands() -> Result { let bindings = keymap .get(cmd.name()) .map(|bindings| { - bindings.iter().fold(String::new(), |mut acc, bind| { - if !acc.is_empty() { - acc.push_str(", "); - } - acc.push_str("`` "); - for key in bind { - acc.push_str(&key.key_sequence_format()); - } - acc.push_str(" ``"); - acc - }) + let mut bind_strings: Vec<_> = bindings + .iter() + .map(|bind| { + let keys = &bind + .iter() + .map(|key| key.key_sequence_format()) + .collect::(); + format!("`` {} ``", keys) + }) + .collect(); + // sort for stable output. sort simple letters-only binds first, then lexicographic + bind_strings.sort_by_key(|s| (s.contains('<'), s.to_owned())); + bind_strings.join(", ") }) .unwrap_or_default();