From 278361a08627240e47503e21a88b81a40f4a1caf Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Sat, 12 Jun 2021 10:20:37 +0900 Subject: Only auto-format for certain languages Fixes #53 Fixes #207 --- helix-term/src/commands.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'helix-term/src') 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()); } -- cgit v1.2.3-70-g09d2