refactor: add dropdown_keybinds configuration option
This commit is contained in:
parent
d59dc65e6b
commit
c4301c40d9
3 changed files with 24 additions and 2 deletions
|
|
@ -71,6 +71,7 @@ centered_view_min_screen_width: usize = 145,
|
||||||
lsp_output: enum { quiet, verbose } = .quiet,
|
lsp_output: enum { quiet, verbose } = .quiet,
|
||||||
|
|
||||||
keybind_mode: KeybindMode = .normal,
|
keybind_mode: KeybindMode = .normal,
|
||||||
|
dropdown_keybinds: DropdownKeybindMode = .standard,
|
||||||
|
|
||||||
include_files: []const u8 = "",
|
include_files: []const u8 = "",
|
||||||
|
|
||||||
|
|
@ -158,6 +159,11 @@ pub const KeybindMode = enum {
|
||||||
ignore_alt_text_modifiers,
|
ignore_alt_text_modifiers,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
pub const DropdownKeybindMode = enum {
|
||||||
|
standard,
|
||||||
|
noninvasive,
|
||||||
|
};
|
||||||
|
|
||||||
pub const InitialFindQuery = enum {
|
pub const InitialFindQuery = enum {
|
||||||
empty,
|
empty,
|
||||||
selection,
|
selection,
|
||||||
|
|
|
||||||
|
|
@ -375,7 +375,7 @@
|
||||||
["right_control", "palette_menu_activate_quick"]
|
["right_control", "palette_menu_activate_quick"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"overlay/dropdown": {
|
"overlay/dropdown-noninvasive": {
|
||||||
"inherit": "normal",
|
"inherit": "normal",
|
||||||
"press": [
|
"press": [
|
||||||
["alt+f9", "dropdown_next_widget_style"],
|
["alt+f9", "dropdown_next_widget_style"],
|
||||||
|
|
@ -388,6 +388,19 @@
|
||||||
["tab", "palette_menu_complete"]
|
["tab", "palette_menu_complete"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"overlay/dropdown": {
|
||||||
|
"inherit": "normal",
|
||||||
|
"press": [
|
||||||
|
["alt+f9", "dropdown_next_widget_style"],
|
||||||
|
["ctrl+p", "palette_menu_up"],
|
||||||
|
["ctrl+n", "palette_menu_down"],
|
||||||
|
["escape", "palette_menu_cancel"],
|
||||||
|
["up", "palette_menu_up"],
|
||||||
|
["down", "palette_menu_down"],
|
||||||
|
["enter", "palette_menu_activate"],
|
||||||
|
["tab", "palette_menu_complete"]
|
||||||
|
]
|
||||||
|
},
|
||||||
"mini/numeric": {
|
"mini/numeric": {
|
||||||
"press": [
|
"press": [
|
||||||
["ctrl+?", "toggle_keybind_hints"],
|
["ctrl+?", "toggle_keybind_hints"],
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,10 @@ pub fn Create(options: type) type {
|
||||||
.query = .empty,
|
.query = .empty,
|
||||||
.view_rows = get_view_rows(tui.screen()),
|
.view_rows = get_view_rows(tui.screen()),
|
||||||
.entries = .empty,
|
.entries = .empty,
|
||||||
.mode = try keybind.mode("overlay/dropdown", allocator, .{
|
.mode = try keybind.mode(switch (tui.config().dropdown_keybinds) {
|
||||||
|
.standard => "overlay/dropdown",
|
||||||
|
.noninvasive => "overlay/dropdown-noninvasive",
|
||||||
|
}, allocator, .{
|
||||||
.insert_command = "overlay_insert_bytes",
|
.insert_command = "overlay_insert_bytes",
|
||||||
}),
|
}),
|
||||||
.placement = if (@hasDecl(options, "placement")) options.placement else .top_center,
|
.placement = if (@hasDecl(options, "placement")) options.placement else .top_center,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue