aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs
index 3cb1288e..edc3dcfd 100644
--- a/helix-term/src/commands.rs
+++ b/helix-term/src/commands.rs
@@ -966,7 +966,13 @@ mod cmd {
editor.set_error("cannot write a buffer without a filename".to_string());
return;
}
- doc.format(view.id); // TODO: merge into save
+ let autofmt = doc
+ .language_config()
+ .map(|config| config.auto_format)
+ .unwrap_or_default();
+ if autofmt {
+ doc.format(view.id); // TODO: merge into save
+ }
tokio::spawn(doc.save());
}