on master help sign in
Add undo checkpoint command (#2115)

* added undo checkpoint command * changed add_undo_checkpoint to commit_undo_checkpoint * mapped commit_undo_checkpoint to Alt-u * Update default.rs Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>

commitac2ea800ce267b9ed3da5f743085f0afe8460473 authorAntonioLucibello <65395340+AntonioLucibello@users.noreply.github.com> dateMon 2 May 2022, 16:45 (4 years ago) parent77ff8d3
2 files changed+7
helix-term/src/commands.rs+6 helix-term/src/keymap/default.rs+1
helix-term/src/commands.rs+6
@@ -318,6 +318,7 @@ impl MappableCommand {
318318 redo, "Redo change",
319319 earlier, "Move backward in history",
320320 later, "Move forward in history",
321+ commit_undo_checkpoint, "Commit changes to a new checkpoint",
321322 yank, "Yank selection",
322323 yank_joined_to_clipboard, "Join and yank selections to clipboard",
323324 yank_main_selection_to_clipboard, "Yank main selection to clipboard",
@@ -3001,6 +3002,11 @@ fn later(cx: &mut Context) {
30013002 }
30023003}
30033004
3005+fn commit_undo_checkpoint(cx: &mut Context) {
3006+ let (view, doc) = current!(cx.editor);
3007+ doc.append_changes_to_history(view.id);
3008+}
3009+
30043010// Yank / Paste
30053011
30063012fn yank(cx: &mut Context) {
helix-term/src/keymap/default.rs+1
@@ -326,6 +326,7 @@ pub fn default() -> HashMap<Mode, Keymap> {
326326 "C-w" => delete_word_backward,
327327 "A-backspace" => delete_word_backward,
328328 "A-d" => delete_word_forward,
329+ "C-s" => commit_undo_checkpoint,
329330
330331 "left" => move_char_left,
331332 "C-b" => move_char_left,