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()); }