From 145bc1970a49a7056b34d3a6f8278a6886acf373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kevin=20Sj=C3=B6berg?= Date: Sat, 5 Jun 2021 22:40:11 +0200 Subject: [PATCH] Trigger directory completion upon pressing Enter --- helix-term/src/ui/prompt.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index cdf303b82..0a88aa908 100644 --- a/helix-term/src/ui/prompt.rs +++ b/helix-term/src/ui/prompt.rs @@ -253,8 +253,13 @@ impl Component for Prompt { code: KeyCode::Enter, .. } => { - (self.callback_fn)(cx.editor, &self.line, PromptEvent::Validate); - return close_fn; + if self.line.ends_with('/') { + self.completion = (self.completion_fn)(&self.line); + self.exit_selection(); + } else { + (self.callback_fn)(cx.editor, &self.line, PromptEvent::Validate); + return close_fn; + } } KeyEvent { code: KeyCode::Tab, ..