aboutsummaryrefslogtreecommitdiff
path: root/src/nix/repl.cc
diff options
context:
space:
mode:
authorzimbatm <zimbatm@zimbatm.com>2019-10-23 16:48:28 +0200
committerzimbatm <zimbatm@zimbatm.com>2019-10-23 16:48:28 +0200
commit207a537343ace1d39ac125059456d832a5237f2e (patch)
treef3f25ceaaffcb480c6130a4896e4d79c87ad90e6 /src/nix/repl.cc
parent73ff84f6a820ac1c6e0fe502692432c8945fd8b0 (diff)
libutil: add editorFor heuristic
Diffstat (limited to 'src/nix/repl.cc')
-rw-r--r--src/nix/repl.cc11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/nix/repl.cc b/src/nix/repl.cc
index 79f365cdb..d4334cf7f 100644
--- a/src/nix/repl.cc
+++ b/src/nix/repl.cc
@@ -506,15 +506,8 @@ bool NixRepl::processLine(string line)
}
// Open in EDITOR
- auto editor = getEnv("EDITOR", "cat");
- auto args = tokenizeString<Strings>(editor);
- if (lineno > 0 && (
- editor.find("emacs") != std::string::npos ||
- editor.find("nano") != std::string::npos ||
- editor.find("vim") != std::string::npos))
- args.push_back(fmt("+%d", lineno));
- args.push_back(filename);
- editor = args.front();
+ auto args = editorFor(filename, lineno);
+ auto editor = args.front();
args.pop_front();
runProgram(editor, args);