From e042dc9913ce1ea37cb4340b16f5c0ff886e323c Mon Sep 17 00:00:00 2001 From: Luis Useche Date: Sun, 29 Dec 2024 16:46:02 -0800 Subject: [PATCH] Exclude file persistence for autostart splits --- helix-term/src/commands/typed.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs index d2d70396a40ef..103cbf784ee4d 100644 --- a/helix-term/src/commands/typed.rs +++ b/helix-term/src/commands/typed.rs @@ -79,7 +79,10 @@ fn quit(cx: &mut compositor::Context, args: &[Cow], event: PromptEvent) -> // last view and we have unsaved changes if cx.editor.tree.views().count() == 1 { // save split in default before quitting - if cx.editor.config().persistence.autostart_splits { + let exclude = doc!(cx.editor).path().map_or(true, |p| { + cx.editor.config().persistence.exclude(&p.to_string_lossy()) + }); + if cx.editor.config().persistence.autostart_splits && !exclude { cx.editor.save_split("".to_string()); } @@ -803,7 +806,12 @@ fn quit_all_impl(cx: &mut compositor::Context, force: bool) -> anyhow::Result<() } // save split in default before quitting - if cx.editor.config().persistence.autostart_splits { + let exclude = cx.editor.tree.views().all(|(v, _)| { + doc!(cx.editor, &v.doc).path().map_or(true, |p| { + cx.editor.config().persistence.exclude(&p.to_string_lossy()) + }) + }); + if cx.editor.config().persistence.autostart_splits && !exclude { cx.editor.save_split("".to_string()); }