summaryrefslogtreecommitdiff
path: root/helix-term/src/ui/mod.rs
diff options
context:
space:
mode:
authorCossonLeo2021-11-04 03:26:01 +0000
committerGitHub2021-11-04 03:26:01 +0000
commit39584cbccdb06b528220a13b643416f3fd5dc3c8 (patch)
tree0735dd712198c3b17596db42696c9b427ed0e34d /helix-term/src/ui/mod.rs
parent70d21a903fef3ec0787c453f369d95e5223a2656 (diff)
Add c-s to pick word under doc cursor to prompt line & search completion (#831)
* Add prompt shourtcut to book Add completions to search Add c-s to pick word under doc cursor to prompt line * limit 20 last items of search completion, update book * Update book/src/keymap.md Co-authored-by: Ivan Tham <pickfire@riseup.net> * limit search completions 200 Co-authored-by: Ivan Tham <pickfire@riseup.net>
Diffstat (limited to 'helix-term/src/ui/mod.rs')
-rw-r--r--helix-term/src/ui/mod.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs
index 30a9ec6b..24eb7acd 100644
--- a/helix-term/src/ui/mod.rs
+++ b/helix-term/src/ui/mod.rs
@@ -29,6 +29,7 @@ pub fn regex_prompt(
cx: &mut crate::commands::Context,
prompt: std::borrow::Cow<'static, str>,
history_register: Option<char>,
+ completion_fn: impl FnMut(&str) -> Vec<prompt::Completion> + 'static,
fun: impl Fn(&mut View, &mut Document, Regex, PromptEvent) + 'static,
) -> Prompt {
let (view, doc) = current!(cx.editor);
@@ -38,7 +39,7 @@ pub fn regex_prompt(
Prompt::new(
prompt,
history_register,
- |_input: &str| Vec::new(), // this is fine because Vec::new() doesn't allocate
+ completion_fn,
move |cx: &mut crate::compositor::Context, input: &str, event: PromptEvent| {
match event {
PromptEvent::Abort => {