feat: add command to enable auto completion
This commit is contained in:
parent
f875dba810
commit
15942f19c7
2 changed files with 12 additions and 0 deletions
|
|
@ -6254,6 +6254,7 @@ pub const Editor = struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_triggers(self: *Self, cursel: *const CurSel, char: u8, event: TriggerEvent) void {
|
pub fn run_triggers(self: *Self, cursel: *const CurSel, char: u8, event: TriggerEvent) void {
|
||||||
|
if (tui.config().completion_trigger == .manual) return;
|
||||||
switch (char) {
|
switch (char) {
|
||||||
'\n', '\t', ' ' => return,
|
'\n', '\t', ' ' => return,
|
||||||
else => {},
|
else => {},
|
||||||
|
|
|
||||||
|
|
@ -1119,6 +1119,17 @@ const cmds = struct {
|
||||||
}
|
}
|
||||||
pub const toggle_completion_style_meta: Meta = .{ .description = "Toggle completion style" };
|
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 {
|
pub fn toggle_keybind_hints(self: *Self, _: Ctx) Result {
|
||||||
self.hint_mode = switch (self.hint_mode) {
|
self.hint_mode = switch (self.hint_mode) {
|
||||||
.all => .prefix,
|
.all => .prefix,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue