From 145bc1970a49a7056b34d3a6f8278a6886acf373 Mon Sep 17 00:00:00 2001 From: Kevin Sjöberg Date: Sat, 5 Jun 2021 22:40:11 +0200 Subject: Trigger directory completion upon pressing Enter --- helix-term/src/ui/prompt.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'helix-term/src/ui/prompt.rs') diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs index cdf303b8..0a88aa90 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, .. -- cgit v1.2.3-70-g09d2