fix: add down level ':' keybindings to vim and helix modes

This is for terminals that don't send modifiers at all.
This commit is contained in:
CJ van den Berg 2024-12-12 16:57:16 +01:00
parent 271516f07f
commit 0abb21a400
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
4 changed files with 9 additions and 2 deletions

View file

@ -86,6 +86,7 @@
["shift+j", "join_selections"],
[":", "open_command_palette"],
["shift+;", "open_command_palette"],
["shift+7", "align_selections"],
@ -352,6 +353,7 @@
["shift+j", "join_selections"],
[":", "open_command_palette"],
["shift+;", "open_command_palette"],
["shift+7", "align_selections"],
@ -507,6 +509,7 @@
"home": {
"on_match_failure": "ignore",
"press": [
[":", "open_command_palette"],
[";", "open_command_palette"],
["shift+;", "open_command_palette"],
["b", "open_keybind_config"],

View file

@ -35,6 +35,7 @@
["n", "goto_next_match"],
["0", "move_begin"],
["<S-4>", "move_end"],
[":", "open_command_palette"],
[";", "open_command_palette"],
["<S-;>", "open_command_palette"],
["p", "paste"],
@ -93,6 +94,7 @@
"syntax": "vim",
"on_match_failure": "ignore",
"press": [
[":", "open_command_palette"],
[";", "open_command_palette"],
["<S-;>", "open_command_palette"],
["b", "open_keybind_config"],

View file

@ -720,6 +720,8 @@ const match_test_cases = .{
.{ "<C-o>", "<C-o>", .matched },
.{ "<S-'><S-->dd", "<S-'><S-->dd", .matched },
.{ "<S-'><S-->dd", "<S-'><S-->da", .match_impossible },
.{ ":", ":", .matched },
.{ ":", ";", .match_impossible },
};
test "match" {

View file

@ -92,7 +92,7 @@ pub fn parse_key_events(allocator: std.mem.Allocator, event: input.Event, str: [
//lowercase characters
'a'...'z',
'0'...'9',
'`', '-', '=', '[', ']', '\\', ';', '\'', ',', '.', '/', => {
'`', '-', '=', '[', ']', '\\', ':', ';', '\'', ',', '.', '/', => {
try result.append(.{ .key = str[i] });
i += 1;
},
@ -340,7 +340,7 @@ pub fn parse_key_events(allocator: std.mem.Allocator, event: input.Event, str: [
//lowercase characters only inside the escape sequence
'a'...'z',
'0'...'9',
'`', '-', '=', '[', ']', '\\', ';', '\'', ',', '.', '/',
'`', '-', '=', '[', ']', '\\', ':', ';', '\'', ',', '.', '/',
=> {
try result.append(.{ .key = str[i], .modifiers = modifiers });
modifiers = 0;