From 9a32617b3093ce6ab3b925d9f1c6b17218c1b491 Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Sun, 12 Dec 2021 21:51:57 +0800 Subject: [PATCH] Rename play macro to replay macro Macro needs to be defined first before playing so replay is more accurate. Also, replay have the same length as record which makes it looks nice. --- book/src/keymap.md | 2 +- helix-term/src/commands.rs | 6 +++--- helix-term/src/keymap.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/book/src/keymap.md b/book/src/keymap.md index e1df545d5..b7a1e54b7 100644 --- a/book/src/keymap.md +++ b/book/src/keymap.md @@ -78,7 +78,7 @@ | `Ctrl-a` | Increment object (number) under cursor | `increment` | | `Ctrl-x` | Decrement object (number) under cursor | `decrement` | | `Q` | Start/stop macro recording to the selected register | `record_macro` | -| `q` | Play back a recorded macro from the selected register | `play_macro` | +| `q` | Play back a recorded macro from the selected register | `replay_macro` | #### Shell diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index e3944cd75..ac42682f1 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -396,7 +396,7 @@ impl MappableCommand { increment, "Increment", decrement, "Decrement", record_macro, "Record macro", - play_macro, "Play macro", + replay_macro, "Replay macro", ); } @@ -6015,7 +6015,7 @@ fn record_macro(cx: &mut Context) { keys.pop(); let s = keys .into_iter() - .map(|key| format!("{}", key)) + .map(|key| key.to_string()) .collect::>() .join(" "); cx.editor.registers.get_mut(reg).write(vec![s]); @@ -6029,7 +6029,7 @@ fn record_macro(cx: &mut Context) { } } -fn play_macro(cx: &mut Context) { +fn replay_macro(cx: &mut Context) { let reg = cx.register.unwrap_or('@'); let keys: Vec = if let Some([keys]) = cx.editor.registers.read(reg) { match keys.split_whitespace().map(str::parse).collect() { diff --git a/helix-term/src/keymap.rs b/helix-term/src/keymap.rs index 917a0990f..08c8032bb 100644 --- a/helix-term/src/keymap.rs +++ b/helix-term/src/keymap.rs @@ -594,7 +594,7 @@ impl Default for Keymaps { "P" => paste_before, "Q" => record_macro, - "q" => play_macro, + "q" => replay_macro, ">" => indent, "<" => unindent,