refactor: split keybinds into one file per namespace

This commit is contained in:
CJ van den Berg 2024-11-18 22:59:55 +01:00
parent 45adc6c7ec
commit 729cc696c2
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
6 changed files with 460 additions and 449 deletions

View file

@ -0,0 +1,17 @@
{
"base": {
"syntax": "vim",
"press": [
["<C-a>", "cursor_line_start"],
["<C-e>", "cursor_line_end"],
["<C-b>", "cursor_left"],
["<C-f>", "cursor_right"],
["<C-p>", "cursor_up"],
["<C-n>", "cursor_down"],
["<C-x><C-s>", "save"],
["<C-x><C-c>", "quit"],
["<C-x>b", "open_recent_files"],
["<A-x>", "open_command_palette"]
]
}
}

View file

@ -0,0 +1,350 @@
{
"normal": {
"press": [
["ctrl+e", "open_recent"],
["ctrl+r", "open_recent_project"],
["ctrl+j", "toggle_panel"],
["ctrl+z", "undo"],
["ctrl+y", "redo"],
["ctrl+q", "quit"],
["ctrl+o", "open_file"],
["ctrl+w", "close_file"],
["ctrl+s", "save_file"],
["ctrl+l", "scroll_view_center_cycle"],
["ctrl+n", "goto_next_match"],
["ctrl+p", "goto_prev_match"],
["ctrl+b", "move_to_char", false],
["ctrl+t", "move_to_char", true],
["ctrl+x", "cut"],
["ctrl+c", "copy"],
["ctrl+v", "system_paste"],
["ctrl+u", "pop_cursor"],
["ctrl+k>ctrl+u", "delete_to_begin"],
["ctrl+k>ctrl+k", "delete_to_end"],
["ctrl+k>ctrl+d", "move_cursor_next_match"],
["ctrl+k>ctrl+t", "change_theme"],
["ctrl+k>ctrl+i", "hover"],
["ctrl+f", "find"],
["ctrl+g", "goto"],
["ctrl+d", "add_cursor_next_match"],
["ctrl+a", "select_all"],
["ctrl+i", "insert_chars", "\t"],
["ctrl+/", "toggle_comment"],
["ctrl+enter", "smart_insert_line_after"],
["ctrl+space", "completion"],
["ctrl+end", "move_buffer_end"],
["ctrl+home", "move_buffer_begin"],
["ctrl+up", "move_scroll_up"],
["ctrl+down", "move_scroll_down"],
["ctrl+page_up", "move_scroll_page_up"],
["ctrl+page_down", "move_scroll_page_down"],
["ctrl+left", "move_word_left"],
["ctrl+right", "move_word_right"],
["ctrl+backspace", "delete_word_left"],
["ctrl+delete", "delete_word_right"],
["ctrl+f5", "toggle_inspector_view"],
["ctrl+f10", "toggle_whitespace_mode"],
["ctrl+f12", "goto_implementation"],
["ctrl+shift+s", "save_as"],
["ctrl+shift+p", "open_command_palette"],
["ctrl+shift+d", "dupe_down"],
["ctrl+shift+z", "redo"],
["ctrl+shift+q", "quit_without_saving"],
["ctrl+shift+w", "close_file_without_saving"],
["ctrl+shift+f", "find_in_files"],
["ctrl+shift+l", "add_cursor_all_matches_async"],
["ctrl+shift+i", "toggle_inspector_view_async"],
["ctrl+shift+m", "show_diagnostics"],
["ctrl+shift+enter", "smart_insert_line_before"],
["ctrl+shift+end", "select_buffer_end"],
["ctrl+shift+home", "select_buffer_begin"],
["ctrl+shift+up", "select_scroll_up"],
["ctrl+shift+down", "select_scroll_down"],
["ctrl+shift+left", "select_word_left"],
["ctrl+shift+right", "select_word_right"],
["ctrl+shift+space", "selections_reverse"],
["alt+o", "open_previous_file"],
["alt+j", "join_next_line"],
["alt+n", "goto_next_file_or_diagnostic"],
["alt+p", "goto_prev_file_or_diagnostic"],
["alt+u", "to_upper"],
["alt+l", "to_lower"],
["alt+c", "switch_case"],
["alt+i", "toggle_inputview"],
["alt+b", "move_word_left"],
["alt+f", "move_word_right"],
["alt+s", "filter", "sort"],
["alt+v", "paste"],
["alt+x", "open_command_palette"],
["alt+left", "jump_back"],
["alt+right", "jump_forward"],
["alt+up", "pull_up"],
["alt+down", "pull_down"],
["alt+enter", "insert_line"],
["alt+f10", "gutter_mode_next"],
["alt+f12", "goto_declaration"],
["alt+shift+p", "open_command_palette"],
["alt+shift+d", "dupe_up"],
["alt+shift+f", "format"],
["alt+shift+s", "filter", "sort", "-u"],
["alt+shift+v", "paste"],
["alt+shift+i", "add_cursors_to_line_ends"],
["alt+shift+left", "shrink_selection"],
["alt+shift+right", "expand_selection"],
["alt+shift+home", "move_scroll_left"],
["alt+shift+end", "move_scroll_right"],
["alt+shift+up", "add_cursor_up"],
["alt+shift+down", "add_cursor_down"],
["alt+shift+f12", "goto_type_definition"],
["shift+f3", "goto_prev_match"],
["shift+f10", "toggle_syntax_highlighting"],
["shift+f12", "references"],
["shift+left", "select_left"],
["shift+right", "select_right"],
["shift+up", "select_up"],
["shift+down", "select_down"],
["shift+home", "smart_select_begin"],
["shift+end", "select_end"],
["shift+page_up", "select_page_up"],
["shift+page_down", "select_page_down"],
["shift+enter", "smart_insert_line_before"],
["shift+backspace", "delete_backward"],
["shift+tab", "unindent"],
["f2", "toggle_input_mode"],
["f3", "goto_next_match"],
["f15", "goto_prev_match"],
["f5", "toggle_inspector_view"],
["f6", "dump_current_line_tree"],
["f7", "dump_current_line"],
["f9", "theme_prev"],
["f10", "theme_next"],
["f11", "toggle_panel"],
["f12", "goto_definition"],
["f34", "toggle_whitespace_mode"],
["escape", "cancel"],
["enter", "smart_insert_line"],
["delete", "delete_forward"],
["backspace", "delete_backward"],
["left", "move_left"],
["right", "move_right"],
["up", "move_up"],
["down", "move_down"],
["home", "smart_move_begin"],
["end", "move_end"],
["page_up", "move_page_up"],
["page_down", "move_page_down"],
["tab", "indent"],
["left_control", "enable_fast_scroll"],
["right_control", "enable_fast_scroll"],
["left_alt", "enable_jump_mode"],
["right_alt", "enable_jump_mode"]
],
"release": [
["left_control", "disable_fast_scroll"],
["right_control", "disable_fast_scroll"],
["left_alt", "disable_jump_mode"],
["right_alt", "disable_jump_mode"]
]
},
"home": {
"on_match_failure": "ignore",
"press": [
["ctrl+f>ctrl+f>ctrl+f>ctrl+f>ctrl+f", "home_sheeran"],
["ctrl+j", "toggle_panel"],
["ctrl+q", "quit"],
["ctrl+w", "quit"],
["ctrl+o", "open_file"],
["ctrl+e", "open_recent"],
["ctrl+r", "open_recent_project"],
["ctrl+p", "open_command_palette"],
["ctrl+k>ctrl+t", "change_theme"],
["ctrl+shift+p", "open_command_palette"],
["ctrl+shift+q", "quit_without_saving"],
["ctrl+shift+r", "restart"],
["ctrl+shift+f", "find_in_files"],
["ctrl+shift+l", "toggle_panel"],
["alt+shift+p", "open_command_palette"],
["alt+n", "goto_next_file_or_diagnostic"],
["alt+p", "goto_prev_file_or_diagnostic"],
["alt+l", "toggle_panel"],
["alt+i", "toggle_inputview"],
["alt+x", "open_command_palette"],
["h", "open_help"],
["o", "open_file"],
["e", "open_recent"],
["r", "open_recent_project"],
["p", "open_command_palette"],
["c", "open_config"],
["t", "change_theme"],
["q", "quit"],
["f1", "open_help"],
["f6", "open_config"],
["f9", "theme_prev"],
["f10", "theme_next"],
["f11", "toggle_panel"],
["f12", "toggle_inputview"],
["up", "home_menu_up"],
["down", "home_menu_down"],
["enter", "home_menu_activate"]
]
},
"palette": {
"press": [
["ctrl+j", "toggle_panel"],
["ctrl+q", "quit"],
["ctrl+w", "close_file"],
["ctrl+p", "palette_menu_up"],
["ctrl+n", "palette_menu_down"],
["ctrl+e", "palette_menu_down"],
["ctrl+r", "palette_menu_down"],
["ctrl+t", "palette_menu_down"],
["ctrl+v", "system_paste"],
["ctrl+c", "palette_menu_cancel"],
["ctrl+g", "palette_menu_cancel"],
["ctrl+escape", "palette_menu_cancel"],
["ctrl+up", "palette_menu_up"],
["ctrl+down", "palette_menu_down"],
["ctrl+page_up", "palette_menu_pageup"],
["ctrl+page_down", "palette_menu_pagedown"],
["ctrl+enter", "palette_menu_activate"],
["ctrl+backspace", "overlay_delete_word_left"],
["ctrl+shift+e", "palette_menu_up"],
["ctrl+shift+r", "palette_menu_up"],
["ctrl+shift+p", "palette_menu_down"],
["ctrl+shift+q", "quit_without_saving"],
["ctrl+shift+w", "close_file_without_saving"],
["ctrl+shift+l", "overlay_toggle_panel"],
["ctrl+shift+i", "overlay_toggle_inputview"],
["alt+shift+p", "palette_menu_down"],
["alt+p", "palette_menu_up"],
["alt+l", "toggle_panel"],
["alt+i", "toggle_inputview"],
["f9", "theme_prev"],
["f10", "theme_next"],
["f11", "toggle_panel"],
["f12", "toggle_inputview"],
["escape", "palette_menu_cancel"],
["up", "palette_menu_up"],
["down", "palette_menu_down"],
["page_up", "palette_menu_pageup"],
["page_down", "palette_menu_pagedown"],
["enter", "palette_menu_activate"],
["backspace", "overlay_delete_backwards"]
],
"release": [
["left_control", "palette_menu_activate_quick"],
["right_control", "palette_menu_activate_quick"]
]
},
"mini/goto": {
"press": [
["ctrl+q", "quit"],
["ctrl+v", "system_paste"],
["ctrl+u", "mini_mode_reset"],
["ctrl+g", "mini_mode_cancel"],
["ctrl+c", "mini_mode_cancel"],
["ctrl+l", "scroll_view_center_cycle"],
["ctrl+space", "mini_mode_cancel"],
["escape", "mini_mode_cancel"],
["enter", "exit_mini_mode"],
["backspace", "mini_mode_delete_backwards"]
]
},
"mini/move_to_char": {
"press": [
["ctrl+g", "mini_mode_cancel"],
["ctrl+c", "mini_mode_cancel"],
["ctrl+l", "scroll_view_center_cycle"],
["escape", "mini_mode_cancel"],
["backspace", "mini_mode_cancel"]
]
},
"mini/file_browser": {
"press": [
["ctrl+q", "quit"],
["ctrl+v", "system_paste"],
["ctrl+u", "mini_mode_reset"],
["ctrl+g", "mini_mode_cancel"],
["ctrl+c", "mini_mode_cancel"],
["ctrl+l", "scroll_view_center_cycle"],
["ctrl+i", "mini_mode_insert_bytes", "\t"],
["ctrl+space", "mini_mode_cancel"],
["ctrl+backspace", "mini_mode_delete_to_previous_path_segment"],
["alt+v", "system_paste"],
["alt+shift+v", "system_paste"],
["shift+tab", "mini_mode_reverse_complete_file"],
["up", "mini_mode_reverse_complete_file"],
["down", "mini_mode_try_complete_file"],
["right", "mini_mode_try_complete_file_forward"],
["left", "mini_mode_delete_to_previous_path_segment"],
["tab", "mini_mode_try_complete_file"],
["escape", "mini_mode_cancel"],
["enter", "mini_mode_select"],
["backspace", "mini_mode_delete_backwards"]
]
},
"mini/find_in_files": {
"press": [
["ctrl+q", "quit"],
["ctrl+v", "system_paste"],
["ctrl+u", "mini_mode_reset"],
["ctrl+g", "exit_mini_mode"],
["ctrl+c", "exit_mini_mode"],
["ctrl+l", "scroll_view_center_cycle"],
["ctrl+f", "goto_next_match"],
["ctrl+n", "goto_next_match"],
["ctrl+p", "goto_prev_match"],
["ctrl+i", "mini_mode_insert_bytes", "\t"],
["ctrl+space", "exit_mini_mode"],
["ctrl+enter", "mini_mode_insert_bytes", "\n"],
["ctrl+backspace", "mini_mode_reset"],
["alt+shift+v", "system_paste"],
["alt+v", "system_paste"],
["alt+n", "goto_next_file"],
["alt+p", "goto_prev_file"],
["shift+enter", "goto_prev_match"],
["shift+f3", "goto_prev_match"],
["up", "select_prev_file"],
["down", "select_next_file"],
["f3", "goto_next_match"],
["f15", "goto_prev_match"],
["f9", "theme_prev"],
["f10", "theme_next"],
["escape", "exit_mini_mode"],
["enter", "mini_mode_select"],
["backspace", "mini_mode_delete_backwards"]
]
},
"mini/find": {
"press": [
["ctrl+q", "quit"],
["ctrl+v", "system_paste"],
["ctrl+u", "mini_mode_reset"],
["ctrl+g", "mini_mode_cancel"],
["ctrl+c", "mini_mode_cancel"],
["ctrl+l", "scroll_view_center_cycle"],
["ctrl+f", "goto_next_match"],
["ctrl+n", "goto_next_match"],
["ctrl+p", "goto_prev_match"],
["ctrl+i", "mini_mode_insert_bytes", "\t"],
["ctrl+space", "mini_mode_cancel"],
["ctrl+enter", "mini_mode_insert_bytes", "\n"],
["ctrl+backspace", "mini_mode_reset"],
["alt+shift+v", "system_paste"],
["alt+v", "system_paste"],
["alt+n", "goto_next_match"],
["alt+p", "goto_prev_match"],
["shift+enter", "goto_prev_match"],
["shift+f3", "goto_prev_match"],
["up", "mini_mode_history_prev"],
["down", "mini_mode_history_next"],
["f3", "goto_next_match"],
["f15", "goto_prev_match"],
["f9", "theme_prev"],
["f10", "theme_next"],
["escape", "mini_mode_cancel"],
["enter", "mini_mode_select"],
["backspace", "mini_mode_delete_backwards"]
]
}
}

View file

@ -0,0 +1,39 @@
{
"normal": {
"syntax": "vim",
"on_match_failure": "ignore",
"press": [
["j", "move_down"],
["k", "move_up"],
["l", "move_right_vim"],
["h", "move_left"],
["<Space>", "move_right_vim"],
["i", "enter_mode", "insert"],
["v", "enter_mode", "visual"],
["/", "find"],
["n", "goto_next_match"],
["0", "move_begin"],
["<S-4>", "move_end"],
[";", "open_command_palette"],
["<S-;>", "open_command_palette"],
["p", "paste"],
["gd", "goto_definition"],
["gi", "goto_implementation"],
["gy", "goto_type_definition"],
["gg", "move_buffer_begin"],
["g<S-d>", "goto_declaration"],
["<S-g>", "move_buffer_end"],
["d<S-4>", "delete_to_end"],
["d4", "delete_to_end"],
["<C-u>", "cursor_half_page_up"],
["<C-d>", "cursor_half_page_down"]
]
},
"insert": {
"syntax": "vim",
"press": [
["jk", "enter_mode", "normal"],
["<Esc>", "enter_mode", "normal"]
]
}
}

View file

@ -0,0 +1,39 @@
{
"normal": {
"syntax": "vim",
"on_match_failure": "ignore",
"press": [
["j", "move_down"],
["k", "move_up"],
["l", "move_right_vim"],
["h", "move_left"],
["<Space>", "move_right_vim"],
["i", "enter_mode", "insert"],
["v", "enter_mode", "visual"],
["/", "find"],
["n", "goto_next_match"],
["0", "move_begin"],
["<S-4>", "move_end"],
[";", "open_command_palette"],
["<S-;>", "open_command_palette"],
["p", "paste"],
["gd", "goto_definition"],
["gi", "goto_implementation"],
["gy", "goto_type_definition"],
["gg", "move_buffer_begin"],
["g<S-d>", "goto_declaration"],
["<S-g>", "move_buffer_end"],
["d<S-4>", "delete_to_end"],
["d4", "delete_to_end"],
["<C-u>", "cursor_half_page_up"],
["<C-d>", "cursor_half_page_down"]
]
},
"insert": {
"syntax": "vim",
"press": [
["jk", "enter_mode", "normal"],
["<Esc>", "enter_mode", "normal"]
]
}
}

View file

@ -43,6 +43,13 @@ pub const mode = struct {
};
};
const builtin_keybinds = std.static_string_map.StaticStringMap([]const u8).initComptime(.{
.{ "flow", @embedFile("builtin/flow.json") },
.{ "vim", @embedFile("builtin/vim.json") },
.{ "helix", @embedFile("builtin/helix.json") },
.{ "emacs", @embedFile("builtin/emacs.json") },
});
fn Handler(namespace_name: []const u8, mode_name: []const u8) type {
return struct {
allocator: std.mem.Allocator,
@ -54,7 +61,6 @@ fn Handler(namespace_name: []const u8, mode_name: []const u8) type {
.allocator = allocator,
.bindings = try BindingSet.init(
allocator,
@embedFile("keybindings.json"),
namespace_name,
mode_name,
if (@hasField(@TypeOf(opts), "insert_command"))
@ -177,7 +183,7 @@ const BindingSet = struct {
}
}
fn init(allocator: std.mem.Allocator, json_string: []const u8, namespace_name: []const u8, mode_name: []const u8, insert_command: []const u8) !@This() {
fn init(allocator: std.mem.Allocator, namespace_name: []const u8, mode_name: []const u8, insert_command: []const u8) !@This() {
var self: @This() = .{
.allocator = allocator,
.current_sequence = try std.ArrayList(KeyEvent).initCapacity(allocator, 16),
@ -191,7 +197,7 @@ const BindingSet = struct {
.mode_name = try allocator.dupe(u8, mode_name),
.insert_command = try allocator.dupe(u8, insert_command),
};
try self.load_json(json_string, namespace_name, mode_name);
try self.load_json(namespace_name, mode_name);
return self;
}
@ -209,26 +215,22 @@ const BindingSet = struct {
self.allocator.free(self.insert_command);
}
fn load_json(self: *@This(), json_string: []const u8, namespace_name: []const u8, mode_name: []const u8) !void {
fn load_json(self: *@This(), namespace_name: []const u8, mode_name: []const u8) !void {
defer self.press.append(.{
.keys = self.allocator.dupe(KeyEvent, &[_]KeyEvent{.{ .key = input.key.f2 }}) catch @panic("failed to add toggle_input_mode fallback"),
.command = self.allocator.dupe(u8, "toggle_input_mode") catch @panic("failed to add toggle_input_mode fallback"),
.args = "",
}) catch {};
const json_string: []const u8 = builtin_keybinds.get(namespace_name) orelse return error.NotFound;
const parsed = try std.json.parseFromSlice(std.json.Value, self.allocator, json_string, .{});
defer parsed.deinit();
if (parsed.value != .object) return error.NotAnObject;
var namespaces = parsed.value.object.iterator();
while (namespaces.next()) |*namespace_entry| {
if (namespace_entry.value_ptr.* != .object) return error.NotAnObject;
if (!std.mem.eql(u8, namespace_entry.key_ptr.*, namespace_name)) continue;
var modes = namespace_entry.value_ptr.object.iterator();
var modes = parsed.value.object.iterator();
while (modes.next()) |mode_entry| {
if (!std.mem.eql(u8, mode_entry.key_ptr.*, mode_name)) continue;
try self.load_set_from_json(mode_entry.value_ptr.*);
}
}
}
fn load_set_from_json(self: *BindingSet, mode_bindings: std.json.Value) (parse_flow.ParseError || parse_vim.ParseError || std.json.ParseFromValueError)!void {
const JsonConfig = struct {

View file

@ -1,436 +0,0 @@
{
"flow": {
"normal": {
"press": [
["ctrl+e", "open_recent"],
["ctrl+r", "open_recent_project"],
["ctrl+j", "toggle_panel"],
["ctrl+z", "undo"],
["ctrl+y", "redo"],
["ctrl+q", "quit"],
["ctrl+o", "open_file"],
["ctrl+w", "close_file"],
["ctrl+s", "save_file"],
["ctrl+l", "scroll_view_center_cycle"],
["ctrl+n", "goto_next_match"],
["ctrl+p", "goto_prev_match"],
["ctrl+b", "move_to_char", false],
["ctrl+t", "move_to_char", true],
["ctrl+x", "cut"],
["ctrl+c", "copy"],
["ctrl+v", "system_paste"],
["ctrl+u", "pop_cursor"],
["ctrl+k>ctrl+u", "delete_to_begin"],
["ctrl+k>ctrl+k", "delete_to_end"],
["ctrl+k>ctrl+d", "move_cursor_next_match"],
["ctrl+k>ctrl+t", "change_theme"],
["ctrl+k>ctrl+i", "hover"],
["ctrl+f", "find"],
["ctrl+g", "goto"],
["ctrl+d", "add_cursor_next_match"],
["ctrl+a", "select_all"],
["ctrl+i", "insert_chars", "\t"],
["ctrl+/", "toggle_comment"],
["ctrl+enter", "smart_insert_line_after"],
["ctrl+space", "completion"],
["ctrl+end", "move_buffer_end"],
["ctrl+home", "move_buffer_begin"],
["ctrl+up", "move_scroll_up"],
["ctrl+down", "move_scroll_down"],
["ctrl+page_up", "move_scroll_page_up"],
["ctrl+page_down", "move_scroll_page_down"],
["ctrl+left", "move_word_left"],
["ctrl+right", "move_word_right"],
["ctrl+backspace", "delete_word_left"],
["ctrl+delete", "delete_word_right"],
["ctrl+f5", "toggle_inspector_view"],
["ctrl+f10", "toggle_whitespace_mode"],
["ctrl+f12", "goto_implementation"],
["ctrl+shift+s", "save_as"],
["ctrl+shift+p", "open_command_palette"],
["ctrl+shift+d", "dupe_down"],
["ctrl+shift+z", "redo"],
["ctrl+shift+q", "quit_without_saving"],
["ctrl+shift+w", "close_file_without_saving"],
["ctrl+shift+f", "find_in_files"],
["ctrl+shift+l", "add_cursor_all_matches_async"],
["ctrl+shift+i", "toggle_inspector_view_async"],
["ctrl+shift+m", "show_diagnostics"],
["ctrl+shift+enter", "smart_insert_line_before"],
["ctrl+shift+end", "select_buffer_end"],
["ctrl+shift+home", "select_buffer_begin"],
["ctrl+shift+up", "select_scroll_up"],
["ctrl+shift+down", "select_scroll_down"],
["ctrl+shift+left", "select_word_left"],
["ctrl+shift+right", "select_word_right"],
["ctrl+shift+space", "selections_reverse"],
["alt+o", "open_previous_file"],
["alt+j", "join_next_line"],
["alt+n", "goto_next_file_or_diagnostic"],
["alt+p", "goto_prev_file_or_diagnostic"],
["alt+u", "to_upper"],
["alt+l", "to_lower"],
["alt+c", "switch_case"],
["alt+i", "toggle_inputview"],
["alt+b", "move_word_left"],
["alt+f", "move_word_right"],
["alt+s", "filter", "sort"],
["alt+v", "paste"],
["alt+x", "open_command_palette"],
["alt+left", "jump_back"],
["alt+right", "jump_forward"],
["alt+up", "pull_up"],
["alt+down", "pull_down"],
["alt+enter", "insert_line"],
["alt+f10", "gutter_mode_next"],
["alt+f12", "goto_declaration"],
["alt+shift+p", "open_command_palette"],
["alt+shift+d", "dupe_up"],
["alt+shift+f", "format"],
["alt+shift+s", "filter", "sort", "-u"],
["alt+shift+v", "paste"],
["alt+shift+i", "add_cursors_to_line_ends"],
["alt+shift+left", "shrink_selection"],
["alt+shift+right", "expand_selection"],
["alt+shift+home", "move_scroll_left"],
["alt+shift+end", "move_scroll_right"],
["alt+shift+up", "add_cursor_up"],
["alt+shift+down", "add_cursor_down"],
["alt+shift+f12", "goto_type_definition"],
["shift+f3", "goto_prev_match"],
["shift+f10", "toggle_syntax_highlighting"],
["shift+f12", "references"],
["shift+left", "select_left"],
["shift+right", "select_right"],
["shift+up", "select_up"],
["shift+down", "select_down"],
["shift+home", "smart_select_begin"],
["shift+end", "select_end"],
["shift+page_up", "select_page_up"],
["shift+page_down", "select_page_down"],
["shift+enter", "smart_insert_line_before"],
["shift+backspace", "delete_backward"],
["shift+tab", "unindent"],
["f2", "toggle_input_mode"],
["f3", "goto_next_match"],
["f15", "goto_prev_match"],
["f5", "toggle_inspector_view"],
["f6", "dump_current_line_tree"],
["f7", "dump_current_line"],
["f9", "theme_prev"],
["f10", "theme_next"],
["f11", "toggle_panel"],
["f12", "goto_definition"],
["f34", "toggle_whitespace_mode"],
["escape", "cancel"],
["enter", "smart_insert_line"],
["delete", "delete_forward"],
["backspace", "delete_backward"],
["left", "move_left"],
["right", "move_right"],
["up", "move_up"],
["down", "move_down"],
["home", "smart_move_begin"],
["end", "move_end"],
["page_up", "move_page_up"],
["page_down", "move_page_down"],
["tab", "indent"],
["left_control", "enable_fast_scroll"],
["right_control", "enable_fast_scroll"],
["left_alt", "enable_jump_mode"],
["right_alt", "enable_jump_mode"]
],
"release": [
["left_control", "disable_fast_scroll"],
["right_control", "disable_fast_scroll"],
["left_alt", "disable_jump_mode"],
["right_alt", "disable_jump_mode"]
]
},
"home": {
"on_match_failure": "ignore",
"press": [
["ctrl+f>ctrl+f>ctrl+f>ctrl+f>ctrl+f", "home_sheeran"],
["ctrl+j", "toggle_panel"],
["ctrl+q", "quit"],
["ctrl+w", "quit"],
["ctrl+o", "open_file"],
["ctrl+e", "open_recent"],
["ctrl+r", "open_recent_project"],
["ctrl+p", "open_command_palette"],
["ctrl+k>ctrl+t", "change_theme"],
["ctrl+shift+p", "open_command_palette"],
["ctrl+shift+q", "quit_without_saving"],
["ctrl+shift+r", "restart"],
["ctrl+shift+f", "find_in_files"],
["ctrl+shift+l", "toggle_panel"],
["alt+shift+p", "open_command_palette"],
["alt+n", "goto_next_file_or_diagnostic"],
["alt+p", "goto_prev_file_or_diagnostic"],
["alt+l", "toggle_panel"],
["alt+i", "toggle_inputview"],
["alt+x", "open_command_palette"],
["h", "open_help"],
["o", "open_file"],
["e", "open_recent"],
["r", "open_recent_project"],
["p", "open_command_palette"],
["c", "open_config"],
["t", "change_theme"],
["q", "quit"],
["f1", "open_help"],
["f6", "open_config"],
["f9", "theme_prev"],
["f10", "theme_next"],
["f11", "toggle_panel"],
["f12", "toggle_inputview"],
["up", "home_menu_up"],
["down", "home_menu_down"],
["enter", "home_menu_activate"]
]
},
"palette": {
"press": [
["ctrl+j", "toggle_panel"],
["ctrl+q", "quit"],
["ctrl+w", "close_file"],
["ctrl+p", "palette_menu_up"],
["ctrl+n", "palette_menu_down"],
["ctrl+e", "palette_menu_down"],
["ctrl+r", "palette_menu_down"],
["ctrl+t", "palette_menu_down"],
["ctrl+v", "system_paste"],
["ctrl+c", "palette_menu_cancel"],
["ctrl+g", "palette_menu_cancel"],
["ctrl+escape", "palette_menu_cancel"],
["ctrl+up", "palette_menu_up"],
["ctrl+down", "palette_menu_down"],
["ctrl+page_up", "palette_menu_pageup"],
["ctrl+page_down", "palette_menu_pagedown"],
["ctrl+enter", "palette_menu_activate"],
["ctrl+backspace", "overlay_delete_word_left"],
["ctrl+shift+e", "palette_menu_up"],
["ctrl+shift+r", "palette_menu_up"],
["ctrl+shift+p", "palette_menu_down"],
["ctrl+shift+q", "quit_without_saving"],
["ctrl+shift+w", "close_file_without_saving"],
["ctrl+shift+l", "overlay_toggle_panel"],
["ctrl+shift+i", "overlay_toggle_inputview"],
["alt+shift+p", "palette_menu_down"],
["alt+p", "palette_menu_up"],
["alt+l", "toggle_panel"],
["alt+i", "toggle_inputview"],
["f9", "theme_prev"],
["f10", "theme_next"],
["f11", "toggle_panel"],
["f12", "toggle_inputview"],
["escape", "palette_menu_cancel"],
["up", "palette_menu_up"],
["down", "palette_menu_down"],
["page_up", "palette_menu_pageup"],
["page_down", "palette_menu_pagedown"],
["enter", "palette_menu_activate"],
["backspace", "overlay_delete_backwards"]
],
"release": [
["left_control", "palette_menu_activate_quick"],
["right_control", "palette_menu_activate_quick"]
]
},
"mini/goto": {
"press": [
["ctrl+q", "quit"],
["ctrl+v", "system_paste"],
["ctrl+u", "mini_mode_reset"],
["ctrl+g", "mini_mode_cancel"],
["ctrl+c", "mini_mode_cancel"],
["ctrl+l", "scroll_view_center_cycle"],
["ctrl+space", "mini_mode_cancel"],
["escape", "mini_mode_cancel"],
["enter", "exit_mini_mode"],
["backspace", "mini_mode_delete_backwards"]
]
},
"mini/move_to_char": {
"press": [
["ctrl+g", "mini_mode_cancel"],
["ctrl+c", "mini_mode_cancel"],
["ctrl+l", "scroll_view_center_cycle"],
["escape", "mini_mode_cancel"],
["backspace", "mini_mode_cancel"]
]
},
"mini/file_browser": {
"press": [
["ctrl+q", "quit"],
["ctrl+v", "system_paste"],
["ctrl+u", "mini_mode_reset"],
["ctrl+g", "mini_mode_cancel"],
["ctrl+c", "mini_mode_cancel"],
["ctrl+l", "scroll_view_center_cycle"],
["ctrl+i", "mini_mode_insert_bytes", "\t"],
["ctrl+space", "mini_mode_cancel"],
["ctrl+backspace", "mini_mode_delete_to_previous_path_segment"],
["alt+v", "system_paste"],
["alt+shift+v", "system_paste"],
["shift+tab", "mini_mode_reverse_complete_file"],
["up", "mini_mode_reverse_complete_file"],
["down", "mini_mode_try_complete_file"],
["right", "mini_mode_try_complete_file_forward"],
["left", "mini_mode_delete_to_previous_path_segment"],
["tab", "mini_mode_try_complete_file"],
["escape", "mini_mode_cancel"],
["enter", "mini_mode_select"],
["backspace", "mini_mode_delete_backwards"]
]
},
"mini/find_in_files": {
"press": [
["ctrl+q", "quit"],
["ctrl+v", "system_paste"],
["ctrl+u", "mini_mode_reset"],
["ctrl+g", "exit_mini_mode"],
["ctrl+c", "exit_mini_mode"],
["ctrl+l", "scroll_view_center_cycle"],
["ctrl+f", "goto_next_match"],
["ctrl+n", "goto_next_match"],
["ctrl+p", "goto_prev_match"],
["ctrl+i", "mini_mode_insert_bytes", "\t"],
["ctrl+space", "exit_mini_mode"],
["ctrl+enter", "mini_mode_insert_bytes", "\n"],
["ctrl+backspace", "mini_mode_reset"],
["alt+shift+v", "system_paste"],
["alt+v", "system_paste"],
["alt+n", "goto_next_file"],
["alt+p", "goto_prev_file"],
["shift+enter", "goto_prev_match"],
["shift+f3", "goto_prev_match"],
["up", "select_prev_file"],
["down", "select_next_file"],
["f3", "goto_next_match"],
["f15", "goto_prev_match"],
["f9", "theme_prev"],
["f10", "theme_next"],
["escape", "exit_mini_mode"],
["enter", "mini_mode_select"],
["backspace", "mini_mode_delete_backwards"]
]
},
"mini/find": {
"press": [
["ctrl+q", "quit"],
["ctrl+v", "system_paste"],
["ctrl+u", "mini_mode_reset"],
["ctrl+g", "mini_mode_cancel"],
["ctrl+c", "mini_mode_cancel"],
["ctrl+l", "scroll_view_center_cycle"],
["ctrl+f", "goto_next_match"],
["ctrl+n", "goto_next_match"],
["ctrl+p", "goto_prev_match"],
["ctrl+i", "mini_mode_insert_bytes", "\t"],
["ctrl+space", "mini_mode_cancel"],
["ctrl+enter", "mini_mode_insert_bytes", "\n"],
["ctrl+backspace", "mini_mode_reset"],
["alt+shift+v", "system_paste"],
["alt+v", "system_paste"],
["alt+n", "goto_next_match"],
["alt+p", "goto_prev_match"],
["shift+enter", "goto_prev_match"],
["shift+f3", "goto_prev_match"],
["up", "mini_mode_history_prev"],
["down", "mini_mode_history_next"],
["f3", "goto_next_match"],
["f15", "goto_prev_match"],
["f9", "theme_prev"],
["f10", "theme_next"],
["escape", "mini_mode_cancel"],
["enter", "mini_mode_select"],
["backspace", "mini_mode_delete_backwards"]
]
}
},
"vim": {
"normal": {
"syntax": "vim",
"on_match_failure": "ignore",
"press": [
["j", "move_down"],
["k", "move_up"],
["l", "move_right_vim"],
["h", "move_left"],
["<Space>", "move_right_vim"],
["i", "enter_mode", "insert"],
["v", "enter_mode", "visual"],
["/", "find"],
["n", "goto_next_match"],
["0", "move_begin"],
["<S-4>", "move_end"],
[";", "open_command_palette"],
["<S-;>", "open_command_palette"],
["p", "paste"],
["gd", "goto_definition"],
["gi", "goto_implementation"],
["gy", "goto_type_definition"],
["gg", "move_buffer_begin"],
["g<S-d>", "goto_declaration"],
["<S-g>", "move_buffer_end"],
["d<S-4>", "delete_to_end"],
["d4", "delete_to_end"],
["<C-u>", "cursor_half_page_up"],
["<C-d>", "cursor_half_page_down"]
]
},
"insert": {
"syntax": "vim",
"press": [
["jk", "enter_mode", "normal"],
["<Esc>", "enter_mode", "normal"]
]
}
},
"emacs" : {
"base": {
"syntax": "vim",
"press": [
["<C-a>", "cursor_line_start"],
["<C-e>", "cursor_line_end"],
["<C-b>", "cursor_left"],
["<C-f>", "cursor_right"],
["<C-p>", "cursor_up"],
["<C-n>", "cursor_down"],
["<C-x><C-s>", "save"],
["<C-x><C-c>", "quit"],
["<C-x>b", "open_recent_files"],
["<A-x>", "open_command_palette"]
]
}
}
}