feat: add command to enable auto completion

This commit is contained in:
CJ van den Berg 2025-12-24 00:47:02 +01:00
parent f875dba810
commit 15942f19c7
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 12 additions and 0 deletions

View file

@ -6254,6 +6254,7 @@ pub const Editor = struct {
}
pub fn run_triggers(self: *Self, cursel: *const CurSel, char: u8, event: TriggerEvent) void {
if (tui.config().completion_trigger == .manual) return;
switch (char) {
'\n', '\t', ' ' => return,
else => {},

View file

@ -1119,6 +1119,17 @@ const cmds = struct {
}
pub const toggle_completion_style_meta: Meta = .{ .description = "Toggle completion style" };
pub fn toggle_completion_trigger(self: *Self, _: Ctx) Result {
self.config_.completion_trigger = switch (self.config_.completion_trigger) {
.manual => .automatic,
.automatic => .manual,
};
defer self.logger.print("{t} completion", .{self.config_.completion_trigger});
try save_config();
resize();
}
pub const toggle_completion_trigger_meta: Meta = .{ .description = "Toggle auto completion" };
pub fn toggle_keybind_hints(self: *Self, _: Ctx) Result {
self.hint_mode = switch (self.hint_mode) {
.all => .prefix,