aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/commands.rs
diff options
context:
space:
mode:
authorBlaž Hrastnik2021-06-12 01:20:37 +0000
committerBlaž Hrastnik2021-06-12 01:20:37 +0000
commit278361a08627240e47503e21a88b81a40f4a1caf (patch)
tree28b9f3053f68da2f8c0331ce123ed72c212bf9e3 /helix-term/src/commands.rs
parent69fe46a122f728b4bb6cb218fd410544097b0dcd (diff)
Only auto-format for certain languages
Fixes #53 Fixes #207
Diffstat (limited to 'helix-term/src/commands.rs')
-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());
}