From df5a1ed1320b58ec82abefdd05313fe369b14e2d Mon Sep 17 00:00:00 2001 From: Daniel Poulin Date: Sat, 14 May 2022 23:28:39 -0400 Subject: [PATCH] WIP on reload all --- helix-term/src/commands/typed.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index 74ab73bef8f5..417f567ed819 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -785,6 +785,19 @@ fn reload( doc.reload(view.id) } +fn reload_all( + cx: &mut compositor::Context, + _args: &[Cow], + _event: PromptEvent, +) -> anyhow::Result<()> { + for doc in cx.editor.documents_mut() { + doc.selections().keys().for_each(|view_id| { + doc.reload(*view_id); + }); + } + Ok(()) +} + fn tree_sitter_scopes( cx: &mut compositor::Context, _args: &[Cow], @@ -1523,6 +1536,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[ fun: reload, completer: None, }, + TypableCommand { + name: "reload-all", + aliases: &[], + doc: "Discard changes and reload all buffers from the source file.", + fun: reload_all, + completer: None, + }, TypableCommand { name: "tree-sitter-scopes", aliases: &[],