refactor: clean-up command naming
This commit is contained in:
parent
f9c029f617
commit
ea31e414ee
11 changed files with 55 additions and 55 deletions
|
@ -257,7 +257,7 @@ pub fn get_mru_position(self: *Self, from: tp.pid_ref, file_path: []const u8) !v
|
||||||
for (self.files.items) |*file| {
|
for (self.files.items) |*file| {
|
||||||
if (!std.mem.eql(u8, file.path, file_path)) continue;
|
if (!std.mem.eql(u8, file.path, file_path)) continue;
|
||||||
if (file.row != 0)
|
if (file.row != 0)
|
||||||
try from.send(.{ "cmd", "goto", .{ file.row + 1, file.col + 1 } });
|
try from.send(.{ "cmd", "goto_line_and_column", .{ file.row + 1, file.col + 1 } });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2976,7 +2976,7 @@ pub const Editor = struct {
|
||||||
self.clamp();
|
self.clamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open_file(self: *Self, ctx: Context) Result {
|
pub fn open_buffer_from_file(self: *Self, ctx: Context) Result {
|
||||||
var file_path: []const u8 = undefined;
|
var file_path: []const u8 = undefined;
|
||||||
if (ctx.args.match(.{tp.extract(&file_path)}) catch false) {
|
if (ctx.args.match(.{tp.extract(&file_path)}) catch false) {
|
||||||
try self.open(file_path);
|
try self.open(file_path);
|
||||||
|
@ -3382,7 +3382,7 @@ pub const Editor = struct {
|
||||||
self.clamp();
|
self.clamp();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn goto(self: *Self, ctx: Context) Result {
|
pub fn goto_line_and_column(self: *Self, ctx: Context) Result {
|
||||||
try self.send_editor_jump_source();
|
try self.send_editor_jump_source();
|
||||||
var line: usize = 0;
|
var line: usize = 0;
|
||||||
var column: usize = 0;
|
var column: usize = 0;
|
||||||
|
|
|
@ -108,7 +108,7 @@ fn menu_action_help(_: **Menu.State(*Self), _: *Button.State(*Menu.State(*Self))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn menu_action_open_file(_: **Menu.State(*Self), _: *Button.State(*Menu.State(*Self))) void {
|
fn menu_action_open_file(_: **Menu.State(*Self), _: *Button.State(*Menu.State(*Self))) void {
|
||||||
command.executeName("enter_open_file_mode", .{}) catch {};
|
command.executeName("open_file", .{}) catch {};
|
||||||
}
|
}
|
||||||
|
|
||||||
fn menu_action_open_recent_file(_: **Menu.State(*Self), _: *Button.State(*Menu.State(*Self))) void {
|
fn menu_action_open_recent_file(_: **Menu.State(*Self), _: *Button.State(*Menu.State(*Self))) void {
|
||||||
|
|
|
@ -289,10 +289,10 @@ const cmds = struct {
|
||||||
editor.send_editor_jump_source() catch {};
|
editor.send_editor_jump_source() catch {};
|
||||||
}
|
}
|
||||||
try self.create_editor();
|
try self.create_editor();
|
||||||
try command.executeName("open_file", command.fmt(.{f}));
|
try command.executeName("open_buffer_from_file", command.fmt(.{f}));
|
||||||
}
|
}
|
||||||
if (goto_args.len != 0) {
|
if (goto_args.len != 0) {
|
||||||
try command.executeName("goto", .{ .args = .{ .buf = goto_args } });
|
try command.executeName("goto_line_and_column", .{ .args = .{ .buf = goto_args } });
|
||||||
} else if (line) |l| {
|
} else if (line) |l| {
|
||||||
try command.executeName("goto_line", command.fmt(.{l}));
|
try command.executeName("goto_line", command.fmt(.{l}));
|
||||||
if (!same_file)
|
if (!same_file)
|
||||||
|
|
|
@ -85,21 +85,21 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
|
||||||
'Z' => self.cmd("undo", .{}),
|
'Z' => self.cmd("undo", .{}),
|
||||||
'Y' => self.cmd("redo", .{}),
|
'Y' => self.cmd("redo", .{}),
|
||||||
'Q' => self.cmd("quit", .{}),
|
'Q' => self.cmd("quit", .{}),
|
||||||
'O' => self.cmd("enter_open_file_mode", .{}),
|
'O' => self.cmd("open_file", .{}),
|
||||||
'W' => self.cmd("close_file", .{}),
|
'W' => self.cmd("close_file", .{}),
|
||||||
'S' => self.cmd("save_file", .{}),
|
'S' => self.cmd("save_file", .{}),
|
||||||
'L' => self.cmd_cycle3("scroll_view_center", "scroll_view_top", "scroll_view_bottom", .{}),
|
'L' => self.cmd_cycle3("scroll_view_center", "scroll_view_top", "scroll_view_bottom", .{}),
|
||||||
'N' => self.cmd("goto_next_match", .{}),
|
'N' => self.cmd("goto_next_match", .{}),
|
||||||
'P' => self.cmd("goto_prev_match", .{}),
|
'P' => self.cmd("goto_prev_match", .{}),
|
||||||
'B' => self.cmd("enter_move_to_char_mode", command.fmt(.{false})),
|
'B' => self.cmd("move_to_char", command.fmt(.{false})),
|
||||||
'T' => self.cmd("enter_move_to_char_mode", command.fmt(.{true})),
|
'T' => self.cmd("move_to_char", command.fmt(.{true})),
|
||||||
'X' => self.cmd("cut", .{}),
|
'X' => self.cmd("cut", .{}),
|
||||||
'C' => self.cmd("copy", .{}),
|
'C' => self.cmd("copy", .{}),
|
||||||
'V' => self.cmd("system_paste", .{}),
|
'V' => self.cmd("system_paste", .{}),
|
||||||
'U' => self.cmd("pop_cursor", .{}),
|
'U' => self.cmd("pop_cursor", .{}),
|
||||||
'K' => self.leader = .{ .keypress = keynormal, .modifiers = modifiers },
|
'K' => self.leader = .{ .keypress = keynormal, .modifiers = modifiers },
|
||||||
'F' => self.cmd("enter_find_mode", .{}),
|
'F' => self.cmd("find", .{}),
|
||||||
'G' => self.cmd("enter_goto_mode", .{}),
|
'G' => self.cmd("goto", .{}),
|
||||||
'D' => self.cmd("add_cursor_next_match", .{}),
|
'D' => self.cmd("add_cursor_next_match", .{}),
|
||||||
'A' => self.cmd("select_all", .{}),
|
'A' => self.cmd("select_all", .{}),
|
||||||
'I' => self.insert_bytes("\t"),
|
'I' => self.insert_bytes("\t"),
|
||||||
|
@ -126,7 +126,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
|
||||||
'Z' => self.cmd("redo", .{}),
|
'Z' => self.cmd("redo", .{}),
|
||||||
'Q' => self.cmd("quit_without_saving", .{}),
|
'Q' => self.cmd("quit_without_saving", .{}),
|
||||||
'W' => self.cmd("close_file_without_saving", .{}),
|
'W' => self.cmd("close_file_without_saving", .{}),
|
||||||
'F' => self.cmd("enter_find_in_files_mode", .{}),
|
'F' => self.cmd("find_in_files", .{}),
|
||||||
'L' => self.cmd_async("add_cursor_all_matches"),
|
'L' => self.cmd_async("add_cursor_all_matches"),
|
||||||
'I' => self.cmd_async("toggle_inspector_view"),
|
'I' => self.cmd_async("toggle_inspector_view"),
|
||||||
'M' => self.cmd("show_diagnostics", .{}),
|
'M' => self.cmd("show_diagnostics", .{}),
|
||||||
|
@ -330,11 +330,11 @@ const hints = tui.KeybindHints.initComptime(.{
|
||||||
.{ "dupe_up", "S-A-d" },
|
.{ "dupe_up", "S-A-d" },
|
||||||
.{ "enable_fast_scroll", "hold Ctrl" },
|
.{ "enable_fast_scroll", "hold Ctrl" },
|
||||||
.{ "enable_jump_mode", "hold Alt" },
|
.{ "enable_jump_mode", "hold Alt" },
|
||||||
.{ "enter_find_in_files_mode", "C-S-f" },
|
.{ "find_in_files", "C-S-f" },
|
||||||
.{ "enter_find_mode", "C-f" },
|
.{ "find", "C-f" },
|
||||||
.{ "enter_goto_mode", "C-g" },
|
.{ "goto", "C-g" },
|
||||||
.{ "enter_move_to_char_mode", "C-b, C-t" }, // true/false
|
.{ "move_to_char", "C-b, C-t" }, // true/false
|
||||||
.{ "enter_open_file_mode", "C-o" },
|
.{ "open_file", "C-o" },
|
||||||
.{ "filter", "A-s" }, // self.cmd("filter", command.fmt(.{"sort"})),
|
.{ "filter", "A-s" }, // self.cmd("filter", command.fmt(.{"sort"})),
|
||||||
// .{ "filter", "S-A-s" }, // self.cmd("filter", command.fmt(.{ "sort", "-u" })),
|
// .{ "filter", "S-A-s" }, // self.cmd("filter", command.fmt(.{ "sort", "-u" })),
|
||||||
.{ "format", "S-A-f" },
|
.{ "format", "S-A-f" },
|
||||||
|
|
|
@ -61,7 +61,7 @@ fn mapPress(self: *Self, keypress: u32, modifiers: u32) tp.result {
|
||||||
'J' => self.cmd("toggle_panel", .{}),
|
'J' => self.cmd("toggle_panel", .{}),
|
||||||
'Q' => self.cmd("quit", .{}),
|
'Q' => self.cmd("quit", .{}),
|
||||||
'W' => self.cmd("quit", .{}),
|
'W' => self.cmd("quit", .{}),
|
||||||
'O' => self.cmd("enter_open_file_mode", .{}),
|
'O' => self.cmd("open_file", .{}),
|
||||||
'E' => self.cmd("open_recent", .{}),
|
'E' => self.cmd("open_recent", .{}),
|
||||||
'P' => self.cmd("open_command_palette", .{}),
|
'P' => self.cmd("open_command_palette", .{}),
|
||||||
'/' => self.cmd("open_help", .{}),
|
'/' => self.cmd("open_help", .{}),
|
||||||
|
@ -72,7 +72,7 @@ fn mapPress(self: *Self, keypress: u32, modifiers: u32) tp.result {
|
||||||
'P' => self.cmd("open_command_palette", .{}),
|
'P' => self.cmd("open_command_palette", .{}),
|
||||||
'Q' => self.cmd("quit_without_saving", .{}),
|
'Q' => self.cmd("quit_without_saving", .{}),
|
||||||
'R' => self.cmd("restart", .{}),
|
'R' => self.cmd("restart", .{}),
|
||||||
'F' => self.cmd("enter_find_in_files_mode", .{}),
|
'F' => self.cmd("find_in_files", .{}),
|
||||||
'L' => self.cmd_async("toggle_panel"),
|
'L' => self.cmd_async("toggle_panel"),
|
||||||
'/' => self.cmd("open_help", .{}),
|
'/' => self.cmd("open_help", .{}),
|
||||||
else => {},
|
else => {},
|
||||||
|
@ -92,7 +92,7 @@ fn mapPress(self: *Self, keypress: u32, modifiers: u32) tp.result {
|
||||||
},
|
},
|
||||||
0 => switch (keypress) {
|
0 => switch (keypress) {
|
||||||
'h' => self.cmd("open_help", .{}),
|
'h' => self.cmd("open_help", .{}),
|
||||||
'o' => self.cmd("enter_open_file_mode", .{}),
|
'o' => self.cmd("open_file", .{}),
|
||||||
'e' => self.cmd("open_recent", .{}),
|
'e' => self.cmd("open_recent", .{}),
|
||||||
'r' => self.msg("open recent project not implemented"),
|
'r' => self.msg("open recent project not implemented"),
|
||||||
'p' => self.cmd("open_command_palette", .{}),
|
'p' => self.cmd("open_command_palette", .{}),
|
||||||
|
@ -154,8 +154,8 @@ fn sheeran(self: *Self) void {
|
||||||
}
|
}
|
||||||
|
|
||||||
const hints = tui.KeybindHints.initComptime(.{
|
const hints = tui.KeybindHints.initComptime(.{
|
||||||
.{ "enter_find_in_files_mode", "C-S-f" },
|
.{ "find_in_files", "C-S-f" },
|
||||||
.{ "enter_open_file_mode", "o, C-o" },
|
.{ "open_file", "o, C-o" },
|
||||||
.{ "open_recent", "e, C-e" },
|
.{ "open_recent", "e, C-e" },
|
||||||
.{ "open_command_palette", "p, C-S-p, S-A-p" },
|
.{ "open_command_palette", "p, C-S-p, S-A-p" },
|
||||||
.{ "home_menu_activate", "enter" },
|
.{ "home_menu_activate", "enter" },
|
||||||
|
|
|
@ -97,14 +97,14 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
|
||||||
'L' => self.cmd_cycle3("scroll_view_center", "scroll_view_top", "scroll_view_bottom", .{}),
|
'L' => self.cmd_cycle3("scroll_view_center", "scroll_view_top", "scroll_view_bottom", .{}),
|
||||||
'N' => self.cmd("goto_next_match", .{}),
|
'N' => self.cmd("goto_next_match", .{}),
|
||||||
'P' => self.cmd("goto_prev_match", .{}),
|
'P' => self.cmd("goto_prev_match", .{}),
|
||||||
'B' => self.cmd("enter_move_to_char_mode", command.fmt(.{false})),
|
'B' => self.cmd("move_to_char", command.fmt(.{false})),
|
||||||
'T' => self.cmd("enter_move_to_char_mode", command.fmt(.{true})),
|
'T' => self.cmd("move_to_char", command.fmt(.{true})),
|
||||||
'X' => self.cmd("cut", .{}),
|
'X' => self.cmd("cut", .{}),
|
||||||
'C' => self.cmd("enter_mode", command.fmt(.{"vim/normal"})),
|
'C' => self.cmd("enter_mode", command.fmt(.{"vim/normal"})),
|
||||||
'V' => self.cmd("system_paste", .{}),
|
'V' => self.cmd("system_paste", .{}),
|
||||||
'K' => self.leader = .{ .keypress = keynormal, .modifiers = modifiers },
|
'K' => self.leader = .{ .keypress = keynormal, .modifiers = modifiers },
|
||||||
'F' => self.cmd("enter_find_mode", .{}),
|
'F' => self.cmd("find", .{}),
|
||||||
'G' => self.cmd("enter_goto_mode", .{}),
|
'G' => self.cmd("goto", .{}),
|
||||||
'O' => self.cmd("run_ls", .{}),
|
'O' => self.cmd("run_ls", .{}),
|
||||||
'A' => self.cmd("select_all", .{}),
|
'A' => self.cmd("select_all", .{}),
|
||||||
'I' => self.insert_bytes("\t"),
|
'I' => self.insert_bytes("\t"),
|
||||||
|
@ -131,7 +131,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
|
||||||
'Z' => self.cmd("redo", .{}),
|
'Z' => self.cmd("redo", .{}),
|
||||||
'Q' => self.cmd("quit_without_saving", .{}),
|
'Q' => self.cmd("quit_without_saving", .{}),
|
||||||
'W' => self.cmd("close_file_without_saving", .{}),
|
'W' => self.cmd("close_file_without_saving", .{}),
|
||||||
'F' => self.cmd("enter_find_in_files_mode", .{}),
|
'F' => self.cmd("find_in_files", .{}),
|
||||||
'L' => self.cmd_async("add_cursor_all_matches"),
|
'L' => self.cmd_async("add_cursor_all_matches"),
|
||||||
'I' => self.cmd_async("toggle_inspector_view"),
|
'I' => self.cmd_async("toggle_inspector_view"),
|
||||||
key.ENTER => self.cmd("smart_insert_line_before", .{}),
|
key.ENTER => self.cmd("smart_insert_line_before", .{}),
|
||||||
|
|
|
@ -104,14 +104,14 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
|
||||||
'L' => self.cmd_cycle3("scroll_view_center", "scroll_view_top", "scroll_view_bottom", .{}),
|
'L' => self.cmd_cycle3("scroll_view_center", "scroll_view_top", "scroll_view_bottom", .{}),
|
||||||
'N' => self.cmd("goto_next_match", .{}),
|
'N' => self.cmd("goto_next_match", .{}),
|
||||||
'P' => self.cmd("goto_prev_match", .{}),
|
'P' => self.cmd("goto_prev_match", .{}),
|
||||||
'B' => self.cmd("enter_move_to_char_mode", command.fmt(.{false})),
|
'B' => self.cmd("move_to_char", command.fmt(.{false})),
|
||||||
'T' => self.cmd("enter_move_to_char_mode", command.fmt(.{true})),
|
'T' => self.cmd("move_to_char", command.fmt(.{true})),
|
||||||
'X' => self.cmd("cut", .{}),
|
'X' => self.cmd("cut", .{}),
|
||||||
'C' => self.cmd("copy", .{}),
|
'C' => self.cmd("copy", .{}),
|
||||||
'V' => self.cmd("system_paste", .{}),
|
'V' => self.cmd("system_paste", .{}),
|
||||||
'K' => self.leader = .{ .keypress = keynormal, .modifiers = modifiers },
|
'K' => self.leader = .{ .keypress = keynormal, .modifiers = modifiers },
|
||||||
'F' => self.cmd("enter_find_mode", .{}),
|
'F' => self.cmd("find", .{}),
|
||||||
'G' => self.cmd("enter_goto_mode", .{}),
|
'G' => self.cmd("goto", .{}),
|
||||||
'A' => self.cmd("select_all", .{}),
|
'A' => self.cmd("select_all", .{}),
|
||||||
'/' => self.cmd("toggle_comment", .{}),
|
'/' => self.cmd("toggle_comment", .{}),
|
||||||
key.ENTER => self.cmd("smart_insert_line_after", .{}),
|
key.ENTER => self.cmd("smart_insert_line_after", .{}),
|
||||||
|
@ -136,7 +136,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
|
||||||
'Z' => self.cmd("redo", .{}),
|
'Z' => self.cmd("redo", .{}),
|
||||||
'Q' => self.cmd("quit_without_saving", .{}),
|
'Q' => self.cmd("quit_without_saving", .{}),
|
||||||
'W' => self.cmd("close_file_without_saving", .{}),
|
'W' => self.cmd("close_file_without_saving", .{}),
|
||||||
'F' => self.cmd("enter_find_in_files_mode", .{}),
|
'F' => self.cmd("find_in_files", .{}),
|
||||||
'L' => self.cmd_async("add_cursor_all_matches"),
|
'L' => self.cmd_async("add_cursor_all_matches"),
|
||||||
'I' => self.cmd_async("toggle_inspector_view"),
|
'I' => self.cmd_async("toggle_inspector_view"),
|
||||||
key.ENTER => self.cmd("smart_insert_line_before", .{}),
|
key.ENTER => self.cmd("smart_insert_line_before", .{}),
|
||||||
|
@ -235,7 +235,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
|
||||||
'a' => self.seq(.{ "move_right", "enter_mode" }, command.fmt(.{"vim/insert"})),
|
'a' => self.seq(.{ "move_right", "enter_mode" }, command.fmt(.{"vim/insert"})),
|
||||||
'v' => self.cmd("enter_mode", command.fmt(.{"vim/visual"})),
|
'v' => self.cmd("enter_mode", command.fmt(.{"vim/visual"})),
|
||||||
|
|
||||||
'/' => self.cmd("enter_find_mode", .{}),
|
'/' => self.cmd("find", .{}),
|
||||||
'n' => self.cmd("goto_next_match", .{}),
|
'n' => self.cmd("goto_next_match", .{}),
|
||||||
|
|
||||||
'h' => self.cmd_count("move_left_vim", .{}),
|
'h' => self.cmd_count("move_left_vim", .{}),
|
||||||
|
@ -515,11 +515,11 @@ const hints = tui.KeybindHints.initComptime(.{
|
||||||
.{ "dupe_up", "S-A-d" },
|
.{ "dupe_up", "S-A-d" },
|
||||||
.{ "enable_fast_scroll", "hold Ctrl" },
|
.{ "enable_fast_scroll", "hold Ctrl" },
|
||||||
.{ "enable_jump_mode", "hold Alt" },
|
.{ "enable_jump_mode", "hold Alt" },
|
||||||
.{ "enter_find_in_files_mode", "C-S-f" },
|
.{ "find_in_files", "C-S-f" },
|
||||||
.{ "enter_find_mode", "C-f, /" },
|
.{ "find", "C-f, /" },
|
||||||
.{ "enter_goto_mode", "C-g" },
|
.{ "goto", "C-g" },
|
||||||
.{ "enter_move_to_char_mode", "C-b, C-t" }, // true/false
|
.{ "move_to_char", "C-b, C-t" }, // true/false
|
||||||
.{ "enter_open_file_mode", "C-o" },
|
.{ "open_file", "C-o" },
|
||||||
.{ "filter", "A-s" }, // self.cmd("filter", command.fmt(.{"sort"})),
|
.{ "filter", "A-s" }, // self.cmd("filter", command.fmt(.{"sort"})),
|
||||||
// .{ "filter", "S-A-s" }, // self.cmd("filter", command.fmt(.{ "sort", "-u" })),
|
// .{ "filter", "S-A-s" }, // self.cmd("filter", command.fmt(.{ "sort", "-u" })),
|
||||||
.{ "format", "S-A-f" },
|
.{ "format", "S-A-f" },
|
||||||
|
|
|
@ -104,14 +104,14 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
|
||||||
'L' => self.cmd_cycle3("scroll_view_center", "scroll_view_top", "scroll_view_bottom", .{}),
|
'L' => self.cmd_cycle3("scroll_view_center", "scroll_view_top", "scroll_view_bottom", .{}),
|
||||||
'N' => self.cmd("goto_next_match", .{}),
|
'N' => self.cmd("goto_next_match", .{}),
|
||||||
'P' => self.cmd("goto_prev_match", .{}),
|
'P' => self.cmd("goto_prev_match", .{}),
|
||||||
'B' => self.cmd("enter_move_to_char_mode", command.fmt(.{false})),
|
'B' => self.cmd("move_to_char", command.fmt(.{false})),
|
||||||
'T' => self.cmd("enter_move_to_char_mode", command.fmt(.{true})),
|
'T' => self.cmd("move_to_char", command.fmt(.{true})),
|
||||||
'X' => self.cmd("cut", .{}),
|
'X' => self.cmd("cut", .{}),
|
||||||
'C' => self.cmd("copy", .{}),
|
'C' => self.cmd("copy", .{}),
|
||||||
'V' => self.cmd("system_paste", .{}),
|
'V' => self.cmd("system_paste", .{}),
|
||||||
'K' => self.leader = .{ .keypress = keynormal, .modifiers = modifiers },
|
'K' => self.leader = .{ .keypress = keynormal, .modifiers = modifiers },
|
||||||
'F' => self.cmd("enter_find_mode", .{}),
|
'F' => self.cmd("find", .{}),
|
||||||
'G' => self.cmd("enter_goto_mode", .{}),
|
'G' => self.cmd("goto", .{}),
|
||||||
'A' => self.cmd("select_all", .{}),
|
'A' => self.cmd("select_all", .{}),
|
||||||
'/' => self.cmd("toggle_comment", .{}),
|
'/' => self.cmd("toggle_comment", .{}),
|
||||||
key.ENTER => self.cmd("smart_insert_line_after", .{}),
|
key.ENTER => self.cmd("smart_insert_line_after", .{}),
|
||||||
|
@ -136,7 +136,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
|
||||||
'Z' => self.cmd("redo", .{}),
|
'Z' => self.cmd("redo", .{}),
|
||||||
'Q' => self.cmd("quit_without_saving", .{}),
|
'Q' => self.cmd("quit_without_saving", .{}),
|
||||||
'W' => self.cmd("close_file_without_saving", .{}),
|
'W' => self.cmd("close_file_without_saving", .{}),
|
||||||
'F' => self.cmd("enter_find_in_files_mode", .{}),
|
'F' => self.cmd("find_in_files", .{}),
|
||||||
'L' => self.cmd_async("add_cursor_all_matches"),
|
'L' => self.cmd_async("add_cursor_all_matches"),
|
||||||
'I' => self.cmd_async("toggle_inspector_view"),
|
'I' => self.cmd_async("toggle_inspector_view"),
|
||||||
key.ENTER => self.cmd("smart_insert_line_before", .{}),
|
key.ENTER => self.cmd("smart_insert_line_before", .{}),
|
||||||
|
@ -233,7 +233,7 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) !void {
|
||||||
'a' => self.seq(.{ "move_right", "enter_mode" }, command.fmt(.{"vim/insert"})),
|
'a' => self.seq(.{ "move_right", "enter_mode" }, command.fmt(.{"vim/insert"})),
|
||||||
'v' => self.cmd("enter_mode", command.fmt(.{"vim/visual"})),
|
'v' => self.cmd("enter_mode", command.fmt(.{"vim/visual"})),
|
||||||
|
|
||||||
'/' => self.cmd("enter_find_mode", .{}),
|
'/' => self.cmd("find", .{}),
|
||||||
'n' => self.cmd("goto_next_match", .{}),
|
'n' => self.cmd("goto_next_match", .{}),
|
||||||
|
|
||||||
'h' => self.cmd_count("select_left", .{}),
|
'h' => self.cmd_count("select_left", .{}),
|
||||||
|
@ -475,11 +475,11 @@ const hints = tui.KeybindHints.initComptime(.{
|
||||||
.{ "dupe_up", "S-A-d" },
|
.{ "dupe_up", "S-A-d" },
|
||||||
.{ "enable_fast_scroll", "hold Ctrl" },
|
.{ "enable_fast_scroll", "hold Ctrl" },
|
||||||
.{ "enable_jump_mode", "hold Alt" },
|
.{ "enable_jump_mode", "hold Alt" },
|
||||||
.{ "enter_find_in_files_mode", "C-S-f" },
|
.{ "find_in_files", "C-S-f" },
|
||||||
.{ "enter_find_mode", "C-f, /" },
|
.{ "find", "C-f, /" },
|
||||||
.{ "enter_goto_mode", "C-g" },
|
.{ "goto", "C-g" },
|
||||||
.{ "enter_move_to_char_mode", "C-b, C-t" }, // true/false
|
.{ "move_to_char", "C-b, C-t" }, // true/false
|
||||||
.{ "enter_open_file_mode", "C-o" },
|
.{ "open_file", "C-o" },
|
||||||
.{ "filter", "A-s" }, // self.cmd("filter", command.fmt(.{"sort"})),
|
.{ "filter", "A-s" }, // self.cmd("filter", command.fmt(.{"sort"})),
|
||||||
// .{ "filter", "S-A-s" }, // self.cmd("filter", command.fmt(.{ "sort", "-u" })),
|
// .{ "filter", "S-A-s" }, // self.cmd("filter", command.fmt(.{ "sort", "-u" })),
|
||||||
.{ "format", "S-A-f" },
|
.{ "format", "S-A-f" },
|
||||||
|
|
|
@ -31,7 +31,7 @@ pub fn create(a: Allocator, parent: Plane, event_handler: ?Widget.EventHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_click(_: *Self, _: *Button.State(Self)) void {
|
fn on_click(_: *Self, _: *Button.State(Self)) void {
|
||||||
command.executeName("enter_goto_mode", .{}) catch {};
|
command.executeName("goto", .{}) catch {};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn layout(self: *Self, _: *Button.State(Self)) Widget.Layout {
|
pub fn layout(self: *Self, _: *Button.State(Self)) Widget.Layout {
|
||||||
|
|
|
@ -654,23 +654,23 @@ const cmds = struct {
|
||||||
if (self.input_mode) |*mode| mode.deinit();
|
if (self.input_mode) |*mode| mode.deinit();
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enter_find_mode(self: *Self, ctx: Ctx) Result {
|
pub fn find(self: *Self, ctx: Ctx) Result {
|
||||||
return enter_mini_mode(self, @import("mode/mini/find.zig"), ctx);
|
return enter_mini_mode(self, @import("mode/mini/find.zig"), ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enter_find_in_files_mode(self: *Self, ctx: Ctx) Result {
|
pub fn find_in_files(self: *Self, ctx: Ctx) Result {
|
||||||
return enter_mini_mode(self, @import("mode/mini/find_in_files.zig"), ctx);
|
return enter_mini_mode(self, @import("mode/mini/find_in_files.zig"), ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enter_goto_mode(self: *Self, ctx: Ctx) Result {
|
pub fn goto(self: *Self, ctx: Ctx) Result {
|
||||||
return enter_mini_mode(self, @import("mode/mini/goto.zig"), ctx);
|
return enter_mini_mode(self, @import("mode/mini/goto.zig"), ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enter_move_to_char_mode(self: *Self, ctx: Ctx) Result {
|
pub fn move_to_char(self: *Self, ctx: Ctx) Result {
|
||||||
return enter_mini_mode(self, @import("mode/mini/move_to_char.zig"), ctx);
|
return enter_mini_mode(self, @import("mode/mini/move_to_char.zig"), ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn enter_open_file_mode(self: *Self, ctx: Ctx) Result {
|
pub fn open_file(self: *Self, ctx: Ctx) Result {
|
||||||
return enter_mini_mode(self, @import("mode/mini/open_file.zig"), ctx);
|
return enter_mini_mode(self, @import("mode/mini/open_file.zig"), ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue