diff --git a/helix-view/src/document.rs b/helix-view/src/document.rs index 29fd736a..edbc96b0 100644 --- a/helix-view/src/document.rs +++ b/helix-view/src/document.rs @@ -774,7 +774,13 @@ impl Document { { use std::process::Stdio; let text = self.text().clone(); + let mut process = tokio::process::Command::new(&fmt_cmd); + + if let Some(doc_dir) = self.path.as_ref().and_then(|path| path.parent()) { + process.current_dir(doc_dir); + } + process .args(fmt_args) .stdin(Stdio::piped())