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>
This commit is contained in:
parent
77ff8d3550
commit
ac2ea800ce
2 changed files with 7 additions and 0 deletions
|
@ -318,6 +318,7 @@ impl MappableCommand {
|
||||||
redo, "Redo change",
|
redo, "Redo change",
|
||||||
earlier, "Move backward in history",
|
earlier, "Move backward in history",
|
||||||
later, "Move forward in history",
|
later, "Move forward in history",
|
||||||
|
commit_undo_checkpoint, "Commit changes to a new checkpoint",
|
||||||
yank, "Yank selection",
|
yank, "Yank selection",
|
||||||
yank_joined_to_clipboard, "Join and yank selections to clipboard",
|
yank_joined_to_clipboard, "Join and yank selections to clipboard",
|
||||||
yank_main_selection_to_clipboard, "Yank main selection to clipboard",
|
yank_main_selection_to_clipboard, "Yank main selection to clipboard",
|
||||||
|
@ -3001,6 +3002,11 @@ fn later(cx: &mut Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn commit_undo_checkpoint(cx: &mut Context) {
|
||||||
|
let (view, doc) = current!(cx.editor);
|
||||||
|
doc.append_changes_to_history(view.id);
|
||||||
|
}
|
||||||
|
|
||||||
// Yank / Paste
|
// Yank / Paste
|
||||||
|
|
||||||
fn yank(cx: &mut Context) {
|
fn yank(cx: &mut Context) {
|
||||||
|
|
|
@ -326,6 +326,7 @@ pub fn default() -> HashMap<Mode, Keymap> {
|
||||||
"C-w" => delete_word_backward,
|
"C-w" => delete_word_backward,
|
||||||
"A-backspace" => delete_word_backward,
|
"A-backspace" => delete_word_backward,
|
||||||
"A-d" => delete_word_forward,
|
"A-d" => delete_word_forward,
|
||||||
|
"C-s" => commit_undo_checkpoint,
|
||||||
|
|
||||||
"left" => move_char_left,
|
"left" => move_char_left,
|
||||||
"C-b" => move_char_left,
|
"C-b" => move_char_left,
|
||||||
|
|
Loading…
Add table
Reference in a new issue