@@ -190,7 +190,11 @@ fn buffer_previous(
193−fn write_impl(cx: &mut compositor::Context, path: Option<&Cow<str>>) -> anyhow::Result<()> {
194+ cx: &mut compositor::Context,
195+ path: Option<&Cow<str>>,
197+) -> anyhow::Result<()> {
194 let jobs = &mut cx.jobs;
198 let jobs = &mut cx.jobs;
195 let doc = doc_mut!(cx.editor);
199 let doc = doc_mut!(cx.editor);
@@ -212,7 +216,7 @@ fn write_impl(cx: &mut compositor::Context, path: Option<&Cow<str>>) -> anyhow::
212 jobs.callback(callback);
216 jobs.callback(callback);
215− let future = doc.format_and_save(fmt);
219+ let future = doc.format_and_save(fmt, force);
216 cx.jobs.add(Job::new(future).wait_before_exiting());
220 cx.jobs.add(Job::new(future).wait_before_exiting());
218 if path.is_some() {
222 if path.is_some() {
@@ -228,7 +232,15 @@ fn write(
228 args: &[Cow<str>],
232 args: &[Cow<str>],
229 _event: PromptEvent,
233 _event: PromptEvent,
230) -> anyhow::Result<()> {
234) -> anyhow::Result<()> {
231− write_impl(cx, args.first())
235+ write_impl(cx, args.first(), false)
239+ cx: &mut compositor::Context,
241+ _event: PromptEvent,
242+) -> anyhow::Result<()> {
243+ write_impl(cx, args.first(), true)
234fn new_file(
246fn new_file(
@@ -381,7 +393,7 @@ fn write_quit(
381 args: &[Cow<str>],
393 args: &[Cow<str>],
382 event: PromptEvent,
394 event: PromptEvent,
383) -> anyhow::Result<()> {
395) -> anyhow::Result<()> {
384− write_impl(cx, args.first())?;
396+ write_impl(cx, args.first(), false)?;
385 quit(cx, &[], event)
397 quit(cx, &[], event)
@@ -390,7 +402,7 @@ fn force_write_quit(
390 args: &[Cow<str>],
402 args: &[Cow<str>],
391 event: PromptEvent,
403 event: PromptEvent,
392) -> anyhow::Result<()> {
404) -> anyhow::Result<()> {
393− write_impl(cx, args.first())?;
405+ write_impl(cx, args.first(), true)?;
394 force_quit(cx, &[], event)
406 force_quit(cx, &[], event)
@@ -447,7 +459,7 @@ fn write_all_impl(
447 jobs.callback(callback);
459 jobs.callback(callback);
450− let future = doc.format_and_save(fmt);
462+ let future = doc.format_and_save(fmt, force);
451 jobs.add(Job::new(future).wait_before_exiting());
463 jobs.add(Job::new(future).wait_before_exiting());
@@ -1140,6 +1152,13 @@ pub const TYPABLE_COMMAND_LIST: &[TypableCommand] = &[
1140 fun: write,
1152 fun: write,
1141 completer: Some(completers::filename),
1153 completer: Some(completers::filename),
1158+ doc: "Write changes to disk forcefully (creating necessary subdirectories). Accepts an optional path (:write some/path.txt)",
1160+ completer: Some(completers::filename),
1143 TypableCommand {
1162 TypableCommand {
1144 name: "new",
1163 name: "new",
1145 aliases: &["n"],
1164 aliases: &["n"],