diff --git a/lib/core/libimagrt/src/runtime.rs b/lib/core/libimagrt/src/runtime.rs index 8bc1cf70..7fe0a959 100644 --- a/lib/core/libimagrt/src/runtime.rs +++ b/lib/core/libimagrt/src/runtime.rs @@ -25,6 +25,7 @@ use std::io::Stdin; pub use clap::App; use toml::Value; +use toml_query::read::TomlValueReadExt; use clap::{Arg, ArgMatches}; @@ -457,7 +458,15 @@ impl<'a> Runtime<'a> { self.cli() .value_of("editor") .map(String::from) + .or_else(|| { + self.config() + .and_then(|v| match v.read("rt.editor") { + Ok(Some(&Value::String(ref s))) => Some(s.clone()), + _ => None, // FIXME silently ignore errors in config is bad + }) + }) .or(env::var("EDITOR").ok()) + .map(|s| {debug!("Editing with '{}'", s); s}) .map(|s| { let mut c = Command::new(s); c.stdin(::std::process::Stdio::inherit());