diff options
author | Nora <nora.widdecke@tu-bs.de> | 2018-12-29 03:12:05 +0100 |
---|---|---|
committer | Nora <nora.widdecke@tu-bs.de> | 2018-12-29 03:14:16 +0100 |
commit | d2b50d9664a61447e57bf758aaa908437ae7f495 (patch) | |
tree | f1227fc9793d91a5475d3a48692d2d0598138efd /src/edit.rs | |
parent | 1f4d12c180db92ea66257ef80e1a3189e431c794 (diff) |
use EDITOR environment variable for edit
Diffstat (limited to 'src/edit.rs')
-rw-r--r-- | src/edit.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/edit.rs b/src/edit.rs index b5a9c97..81864ba 100644 --- a/src/edit.rs +++ b/src/edit.rs @@ -1,6 +1,7 @@ use utils; use std::fs; use std::process::Command; +use std::env; pub fn do_edit(filenames: &mut Iterator<Item = String>, _args: &[String]) { @@ -14,9 +15,11 @@ pub fn do_edit(filenames: &mut Iterator<Item = String>, _args: &[String]) { paths.sort_unstable(); paths.dedup(); - Command::new("vim") + let editor = env::var("EDITOR").unwrap_or("vim".to_string()); + + Command::new(&editor) .args(paths) .stdin(fs::File::open("/dev/tty").unwrap()) .status() - .expect("vim command failed to start"); + .expect(&format!("{} command failed to start", editor)); } |