summaryrefslogtreecommitdiff
path: root/helix-term
diff options
context:
space:
mode:
authorRoland Kovacs2022-05-02 14:18:41 +0000
committerGitHub2022-05-02 14:18:41 +0000
commit567ddef388986dd2cea5c7f3eb1aa1a978c3e6d3 (patch)
tree8f5f8449ec9fb8040d1e7190a27d69389397c264 /helix-term
parentf85f0b72729ebbc1d93020b1c1a52a2f2fb3bc59 (diff)
Auto-complete directory members (#1801) (#1907)
Allow tab-completion to continue when there is only a single, unambigous completion target which is a directory. This allows e.g. nested directories to be quickly drilled down just by hitting <tab> instead of first selecting the completion then hitting <enter>.
Diffstat (limited to 'helix-term')
-rw-r--r--helix-term/src/ui/prompt.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index 165d87c7..ef08edf2 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -526,6 +526,11 @@ impl Component for Prompt {
}
key!(Tab) => {
self.change_completion_selection(CompletionDirection::Forward);
+ // if single completion candidate is a directory list content in completion
+ if self.completion.len() == 1 && self.line.ends_with(std::path::MAIN_SEPARATOR) {
+ self.recalculate_completion(cx.editor);
+ self.exit_selection();
+ }
(self.callback_fn)(cx, &self.line, PromptEvent::Update)
}
shift!(Tab) => {