From a87cb8705a2c443c5968c8de415f70960cec5f2d Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Fri, 22 Apr 2022 10:34:23 -0500 Subject: [PATCH 1/2] fix command name for next/prev paragraph motion --- book/src/keymap.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 942292e0bafb..69f2b8cd1bdd 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -277,8 +277,8 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire | `[a` | Go to previous argument/parameter (**TS**) | `goto_prev_parameter` | | `]o` | Go to next comment (**TS**) | `goto_next_comment` | | `[o` | Go to previous comment (**TS**) | `goto_prev_comment` | -| `]p` | Go to next paragraph | `goto_next_paragraph` | -| `[p` | Go to previous paragraph | `goto_prev_paragraph` | +| `]p` | Go to next paragraph | `move_next_paragraph` | +| `[p` | Go to previous paragraph | `move_prev_paragraph` | | `[space` | Add newline above | `add_newline_above` | | `]space` | Add newline below | `add_newline_below` | From 013598df45b09b2a8027d8d6180706041c57ddb0 Mon Sep 17 00:00:00 2001 From: Michael Davis Date: Sat, 23 Apr 2022 08:51:19 -0500 Subject: [PATCH 2/2] rename move_next/prev_paragraph to goto_next/prev_paragraph --- book/src/keymap.md | 4 ++-- helix-term/src/commands.rs | 14 +++++++------- helix-term/src/keymap/default.rs | 4 ++-- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index 69f2b8cd1bdd..942292e0bafb 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -277,8 +277,8 @@ Mappings in the style of [vim-unimpaired](https://github.com/tpope/vim-unimpaire | `[a` | Go to previous argument/parameter (**TS**) | `goto_prev_parameter` | | `]o` | Go to next comment (**TS**) | `goto_next_comment` | | `[o` | Go to previous comment (**TS**) | `goto_prev_comment` | -| `]p` | Go to next paragraph | `move_next_paragraph` | -| `[p` | Go to previous paragraph | `move_prev_paragraph` | +| `]p` | Go to next paragraph | `goto_next_paragraph` | +| `[p` | Go to previous paragraph | `goto_prev_paragraph` | | `[space` | Add newline above | `add_newline_above` | | `]space` | Add newline below | `add_newline_below` | diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 4e13f74ade8c..39328d032da9 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -209,8 +209,6 @@ impl MappableCommand { move_next_long_word_start, "Move to beginning of next long word", move_prev_long_word_start, "Move to beginning of previous long word", move_next_long_word_end, "Move to end of next long word", - move_prev_paragraph, "Move to previous paragraph", - move_next_paragraph, "Move to next paragraph", extend_next_word_start, "Extend to beginning of next word", extend_prev_word_start, "Extend to beginning of previous word", extend_next_long_word_start, "Extend to beginning of next long word", @@ -390,6 +388,8 @@ impl MappableCommand { goto_prev_parameter, "Goto previous parameter", goto_next_comment, "Goto next comment", goto_prev_comment, "Goto previous comment", + goto_next_paragraph, "Goto next paragraph", + goto_prev_paragraph, "Goto previous paragraph", dap_launch, "Launch debug target", dap_toggle_breakpoint, "Toggle breakpoint", dap_continue, "Continue program execution", @@ -905,7 +905,7 @@ fn move_next_long_word_end(cx: &mut Context) { move_word_impl(cx, movement::move_next_long_word_end) } -fn move_para_impl(cx: &mut Context, move_fn: F) +fn goto_para_impl(cx: &mut Context, move_fn: F) where F: Fn(RopeSlice, Range, usize, Movement) -> Range + 'static, { @@ -929,12 +929,12 @@ where cx.editor.last_motion = Some(Motion(Box::new(motion))); } -fn move_prev_paragraph(cx: &mut Context) { - move_para_impl(cx, movement::move_prev_paragraph) +fn goto_prev_paragraph(cx: &mut Context) { + goto_para_impl(cx, movement::move_prev_paragraph) } -fn move_next_paragraph(cx: &mut Context) { - move_para_impl(cx, movement::move_next_paragraph) +fn goto_next_paragraph(cx: &mut Context) { + goto_para_impl(cx, movement::move_next_paragraph) } fn goto_file_start(cx: &mut Context) { diff --git a/helix-term/src/keymap/default.rs b/helix-term/src/keymap/default.rs index 18ebbcfed761..10a43d122359 100644 --- a/helix-term/src/keymap/default.rs +++ b/helix-term/src/keymap/default.rs @@ -104,7 +104,7 @@ pub fn default() -> HashMap { "c" => goto_prev_class, "a" => goto_prev_parameter, "o" => goto_prev_comment, - "p" => move_prev_paragraph, + "p" => goto_prev_paragraph, "space" => add_newline_above, }, "]" => { "Right bracket" @@ -114,7 +114,7 @@ pub fn default() -> HashMap { "c" => goto_next_class, "a" => goto_next_parameter, "o" => goto_next_comment, - "p" => move_next_paragraph, + "p" => goto_next_paragraph, "space" => add_newline_below, },