feat: add alternate keybinding for command palette

For terminals that block C-S-p.
This commit is contained in:
CJ van den Berg 2024-06-21 12:40:07 +02:00
parent 5cc944f0e4
commit 394874fb20
6 changed files with 17 additions and 4 deletions

View file

@ -159,6 +159,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result {
else => {},
},
mod.ALT | mod.SHIFT => switch (keynormal) {
'P' => self.cmd("open_command_palette", .{}),
'D' => self.cmd("dupe_up", .{}),
// 'B' => self.cmd("select_word_left", .{}),
// 'F' => self.cmd("select_word_right", .{}),
@ -363,7 +364,7 @@ const hints = tui.KeybindHints.initComptime(.{
.{ "move_up", "up" },
.{ "move_word_left", "C-left, A-b" },
.{ "move_word_right", "C-right, A-f" },
.{ "open_command_palette", "C-S-p" },
.{ "open_command_palette", "C-S-p, S-A-p" },
.{ "open_recent", "C-e" },
.{ "paste", "A-v" },
.{ "pop_cursor", "C-u" },

View file

@ -75,6 +75,10 @@ fn mapPress(self: *Self, keypress: u32, modifiers: u32) tp.result {
'/' => self.cmd("open_help", .{}),
else => {},
},
mod.ALT | mod.SHIFT => switch (keynormal) {
'P' => self.cmd("open_command_palette", .{}),
else => {},
},
mod.ALT => switch (keynormal) {
'L' => self.cmd("toggle_logview", .{}),
'I' => self.cmd("toggle_inputview", .{}),
@ -130,7 +134,7 @@ const hints = tui.KeybindHints.initComptime(.{
.{ "enter_find_in_files_mode", "C-S-f" },
.{ "enter_open_file_mode", "o, C-o" },
.{ "open_recent", "e, C-e" },
.{ "open_command_palette", "p, C-S-p" },
.{ "open_command_palette", "p, C-S-p, S-A-p" },
.{ "home_menu_activate", "enter" },
.{ "home_menu_down", "down" },
.{ "home_menu_up", "up" },

View file

@ -161,6 +161,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result {
else => {},
},
mod.ALT | mod.SHIFT => switch (keynormal) {
'P' => self.cmd("open_command_palette", .{}),
'D' => self.cmd("dupe_up", .{}),
'F' => self.cmd("filter", command.fmt(.{ "zig", "fmt", "--stdin" })),
'S' => self.cmd("filter", command.fmt(.{ "sort", "-u" })),

View file

@ -166,6 +166,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result {
else => {},
},
mod.ALT | mod.SHIFT => switch (keynormal) {
'P' => self.cmd("open_command_palette", .{}),
'D' => self.cmd("dupe_up", .{}),
'F' => self.cmd("filter", command.fmt(.{ "zig", "fmt", "--stdin" })),
'S' => self.cmd("filter", command.fmt(.{ "sort", "-u" })),
@ -552,7 +553,7 @@ const hints = tui.KeybindHints.initComptime(.{
.{ "move_word_left", "C-left, A-b, b" },
.{ "move_word_right", "C-right, A-f, e" },
.{ "move_word_right_vim", "w" },
.{ "open_command_palette", "C-S-p, :, S-;" },
.{ "open_command_palette", "C-S-p, :, S-;, S-A-p" },
.{ "open_recent", "C-e" },
.{ "paste", "A-v, p" },
.{ "pop_cursor", "C-u" },

View file

@ -166,6 +166,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result {
else => {},
},
mod.ALT | mod.SHIFT => switch (keynormal) {
'P' => self.cmd("open_command_palette", .{}),
'D' => self.cmd("dupe_up", .{}),
'F' => self.cmd("filter", command.fmt(.{ "zig", "fmt", "--stdin" })),
'S' => self.cmd("filter", command.fmt(.{ "sort", "-u" })),
@ -512,7 +513,7 @@ const hints = tui.KeybindHints.initComptime(.{
.{ "move_word_left", "C-left, A-b, b" },
.{ "move_word_right", "C-right, A-f, e" },
.{ "move_word_right_vim", "w" },
.{ "open_command_palette", "C-S-p, :, S-;" },
.{ "open_command_palette", "C-S-p, :, S-;, S-A-p" },
.{ "open_recent", "C-e" },
.{ "paste", "A-v, p" },
.{ "pop_cursor", "C-u" },

View file

@ -207,7 +207,12 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result {
'I' => self.cmd_async("toggle_inputview"),
else => {},
},
mod.ALT | mod.SHIFT => switch (keynormal) {
'P' => self.cmd("command_palette_menu_down", .{}),
else => {},
},
mod.ALT => switch (keynormal) {
'P' => self.cmd("command_palette_menu_up", .{}),
'L' => self.cmd("toggle_logview", .{}),
'I' => self.cmd("toggle_inputview", .{}),
else => {},