feat: add open_previous_file command

closes #56
This commit is contained in:
CJ van den Berg 2024-10-24 18:27:30 +02:00
parent d33d5dcac2
commit 3b4c81c706
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
8 changed files with 30 additions and 8 deletions

View file

@ -143,6 +143,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
else => {},
},
mod.ALT => switch (keynormal) {
'O' => self.cmd("open_previous_file", .{}),
'J' => self.cmd("join_next_line", .{}),
'N' => self.cmd("goto_next_file_or_diagnostic", .{}),
'P' => self.cmd("goto_prev_file_or_diagnostic", .{}),
@ -383,6 +384,7 @@ const hints = tui.KeybindHints.initComptime(.{
.{ "move_word_right", "C-right, A-f" },
.{ "open_command_palette", "C-S-p, S-A-p, A-x" },
.{ "open_file", "C-o" },
.{ "open_previous_file", "A-o" },
.{ "open_recent", "C-e" },
.{ "open_recent_project", "C-r" },
.{ "paste", "A-v" },

View file

@ -105,6 +105,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
},
mod.CTRL | mod.SHIFT => switch (keynormal) {
'P' => self.cmd("open_command_palette", .{}),
'6' => self.cmd("open_previous_file", .{}),
else => {},
},
mod.ALT => switch (keynormal) {
@ -604,6 +605,7 @@ const hints = tui.KeybindHints.initComptime(.{
.{ "move_word_right", "C-right, A-f, e" },
.{ "move_word_right_vim", "w" },
.{ "open_command_palette", "Space ?, C-S-p, :, S-;, S-A-p" },
.{ "open_previous_file", "C-^" },
.{ "open_recent", "C-e" },
.{ "paste", "A-v, p" },
.{ "pop_cursor", "C-u" },

View file

@ -105,6 +105,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
},
mod.CTRL | mod.SHIFT => switch (keynormal) {
'P' => self.cmd("open_command_palette", .{}),
'6' => self.cmd("open_previous_file", .{}),
else => {},
},
mod.ALT => switch (keynormal) {
@ -604,6 +605,7 @@ const hints = tui.KeybindHints.initComptime(.{
.{ "move_word_right", "C-right, A-f, e" },
.{ "move_word_right_vim", "w" },
.{ "open_command_palette", "Space ?, C-S-p, :, S-;, S-A-p" },
.{ "open_previous_file", "C-^" },
.{ "open_recent", "C-e" },
.{ "paste", "A-v, p" },
.{ "pop_cursor", "C-u" },

View file

@ -138,6 +138,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
'F' => self.cmd("find_in_files", .{}),
'L' => self.cmd_async("add_cursor_all_matches"),
'I' => self.cmd_async("toggle_inspector_view"),
'6' => self.cmd("open_previous_file", .{}),
key.ENTER => self.cmd("smart_insert_line_before", .{}),
key.END => self.cmd("select_buffer_end", .{}),
key.HOME => self.cmd("select_buffer_begin", .{}),
@ -571,6 +572,7 @@ const hints = tui.KeybindHints.initComptime(.{
.{ "move_word_right", "C-right, A-f, e" },
.{ "move_word_right_vim", "w" },
.{ "open_command_palette", "C-S-p, :, S-;, S-A-p" },
.{ "open_previous_file", "C-^" },
.{ "open_recent", "C-e" },
.{ "paste", "A-v, p" },
.{ "pop_cursor", "C-u" },

View file

@ -138,6 +138,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
'F' => self.cmd("find_in_files", .{}),
'L' => self.cmd_async("add_cursor_all_matches"),
'I' => self.cmd_async("toggle_inspector_view"),
'6' => self.cmd("open_previous_file", .{}),
key.ENTER => self.cmd("smart_insert_line_before", .{}),
key.END => self.cmd("select_buffer_end", .{}),
key.HOME => self.cmd("select_buffer_begin", .{}),
@ -481,6 +482,7 @@ const hints = tui.KeybindHints.initComptime(.{
.{ "find", "C-f, /" },
.{ "goto", "C-g" },
.{ "move_to_char", "C-b, C-t" }, // true/false
.{ "open_previous_file", "C-^" },
.{ "open_file", "C-o" },
.{ "filter", "A-s" }, // self.cmd("filter", command.fmt(.{"sort"})),
// .{ "filter", "S-A-s" }, // self.cmd("filter", command.fmt(.{ "sort", "-u" })),