diff --git a/yazi-config/preset/keymap.toml b/yazi-config/preset/keymap.toml index d2350efe..9a2b7c28 100644 --- a/yazi-config/preset/keymap.toml +++ b/yazi-config/preset/keymap.toml @@ -231,7 +231,7 @@ keymap = [ { on = "", run = "move 999", desc = "Move to the EOL" }, # Delete - { on = "", run = "backspace", desc = "Delete the character before the cursor" }, + { on = "", run = "backspace", desc = "Delete the character before the cursor" }, { on = "", run = "backspace --under", desc = "Delete the character under the cursor" }, { on = "", run = "backspace", desc = "Delete the character before the cursor" }, { on = "", run = "backspace --under", desc = "Delete the character under the cursor" }, diff --git a/yazi-config/src/keymap/key.rs b/yazi-config/src/keymap/key.rs index d9a78106..7f8f1880 100644 --- a/yazi-config/src/keymap/key.rs +++ b/yazi-config/src/keymap/key.rs @@ -67,9 +67,8 @@ impl FromStr for Key { let mut key = Self::default(); if !s.starts_with('<') || !s.ends_with('>') { - let c = s.chars().next().unwrap(); - key.code = KeyCode::Char(c); - key.shift = c.is_ascii_uppercase(); + key.code = KeyCode::Char(s.chars().next().unwrap()); + key.shift = matches!(key.code, KeyCode::Char(c) if c.is_ascii_uppercase()); return Ok(key); } @@ -118,7 +117,10 @@ impl FromStr for Key { "esc" => key.code = KeyCode::Esc, _ => match next { - s if it.peek().is_none() => key.code = KeyCode::Char(s.chars().next().unwrap()), + s if it.peek().is_none() => { + key.code = KeyCode::Char(s.chars().next().unwrap()); + key.shift = matches!(key.code, KeyCode::Char(c) if c.is_ascii_uppercase()); + } s => bail!("unknown key: {s}"), }, }