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,
|
||||
|
||||
keybind_mode: KeybindMode = .normal,
|
||||
dropdown_keybinds: DropdownKeybindMode = .standard,
|
||||
|
||||
include_files: []const u8 = "",
|
||||
|
||||
|
|
@ -158,6 +159,11 @@ pub const KeybindMode = enum {
|
|||
ignore_alt_text_modifiers,
|
||||
};
|
||||
|
||||
pub const DropdownKeybindMode = enum {
|
||||
standard,
|
||||
noninvasive,
|
||||
};
|
||||
|
||||
pub const InitialFindQuery = enum {
|
||||
empty,
|
||||
selection,
|
||||
|
|
|
|||
|
|
@ -375,7 +375,7 @@
|
|||
["right_control", "palette_menu_activate_quick"]
|
||||
]
|
||||
},
|
||||
"overlay/dropdown": {
|
||||
"overlay/dropdown-noninvasive": {
|
||||
"inherit": "normal",
|
||||
"press": [
|
||||
["alt+f9", "dropdown_next_widget_style"],
|
||||
|
|
@ -388,6 +388,19 @@
|
|||
["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": {
|
||||
"press": [
|
||||
["ctrl+?", "toggle_keybind_hints"],
|
||||
|
|
|
|||
|
|
@ -93,7 +93,10 @@ pub fn Create(options: type) type {
|
|||
.query = .empty,
|
||||
.view_rows = get_view_rows(tui.screen()),
|
||||
.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",
|
||||
}),
|
||||
.placement = if (@hasDecl(options, "placement")) options.placement else .top_center,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue