Revert cc behaviour to the original behaviour

Also updated the S key bind to match the cc behaviour.
This commit is contained in:
hankertrix 2025-04-30 01:52:16 +08:00
parent d3b1085382
commit 9c0abc31c9
2 changed files with 11 additions and 11 deletions

View file

@ -286,16 +286,16 @@ keymap = [
{ on = "<A-d>", run = "kill forward", desc = "Kill forwards to the end of the current word" },
# Cut/Yank/Paste
{ on = "d", run = "delete --cut", desc = "Cut selected characters" },
{ on = "D", run = [ "delete --cut", "move eol" ], desc = "Cut until EOL" },
{ on = "c", run = "delete --cut --insert", desc = "Cut selected characters, and enter insert mode" },
{ on = "C", run = [ "delete --cut --insert", "move eol" ], desc = "Cut until EOL, and enter insert mode" },
{ on = "x", run = [ "delete --cut", "move 1 --in-operating" ], desc = "Cut current character" },
{ on = "s", run = [ "delete --cut --insert", "move 1" ], desc = "Cut current character, and enter insert mode" },
{ on = "S", run = [ "move first-char", "delete --cut --insert", "move eol"], desc = "Cut from the first character until EOL, and enter insert mode" },
{ on = "y", run = "yank", desc = "Copy selected characters" },
{ on = "p", run = "paste", desc = "Paste copied characters after the cursor" },
{ on = "P", run = "paste --before", desc = "Paste copied characters before the cursor" },
{ on = "d", run = "delete --cut", desc = "Cut selected characters" },
{ on = "D", run = [ "delete --cut", "move eol" ], desc = "Cut until EOL" },
{ on = "c", run = "delete --cut --insert", desc = "Cut selected characters, and enter insert mode" },
{ on = "C", run = [ "delete --cut --insert", "move eol" ], desc = "Cut until EOL, and enter insert mode" },
{ on = "x", run = [ "delete --cut", "move 1 --in-operating" ], desc = "Cut current character" },
{ on = "s", run = [ "delete --cut --insert", "move 1" ], desc = "Cut current character, and enter insert mode" },
{ on = "S", run = [ "move bol", "delete --cut --insert", "move eol"], desc = "Cut from the BOL until EOL, and enter insert mode" },
{ on = "y", run = "yank", desc = "Copy selected characters" },
{ on = "p", run = "paste", desc = "Paste copied characters after the cursor" },
{ on = "P", run = "paste --before", desc = "Paste copied characters before the cursor" },
# Undo/Redo
{ on = "u", run = "undo", desc = "Undo the last operation" },

View file

@ -25,7 +25,7 @@ impl Input {
self.move_(0);
}
InputOp::Delete(..) => {
self.snap_mut().op = InputOp::Delete(opt.cut, opt.insert, self.snap().value.chars().enumerate().find(|(_, c)| !c.is_whitespace()).map_or(0, |(i, _)| i));
self.snap_mut().op = InputOp::Delete(opt.cut, opt.insert, 0);
self.move_(self.snap().len() as isize);
}
_ => {}