diff --git a/helix-term/src/ui/filetree.rs b/helix-term/src/ui/filetree.rs index f5aa2c05..dcd6355f 100644 --- a/helix-term/src/ui/filetree.rs +++ b/helix-term/src/ui/filetree.rs @@ -248,6 +248,19 @@ impl Filetree { ctx.editor.filetree.focused = false; EventResult::Consumed(None) } + // Forward leader / command-line keys to the editor so leader + // sequences like f (file picker) and the `:` command + // prompt work from within the panel. We unfocus first so the + // key (and any subsequent keys in a sequence) route to the + // editor's keymap rather than ours — emulating Helix's + // leader state machine from here would mean tracking a + // multi-key trie, and the modal "lose focus, regain with + // e" pattern is both simpler and the convention + // pickers already follow. + KeyCode::Char(' ' | ':') if key.modifiers.is_empty() => { + ctx.editor.filetree.focused = false; + EventResult::Ignored(None) + } KeyCode::Down | KeyCode::Char('j') => { self.move_cursor(&mut ctx.editor.filetree, 1); EventResult::Consumed(None)