forked from lix-project/lix
1bd03ad100
The REPL itself and the `nix repl` CLI are conceptually different things, and thus deserve to be in different files.
21 lines
535 B
C++
21 lines
535 B
C++
#include "util.hh"
|
|
#include "editor-for.hh"
|
|
|
|
namespace nix {
|
|
|
|
Strings editorFor(const Path & file, uint32_t line)
|
|
{
|
|
auto editor = getEnv("EDITOR").value_or("cat");
|
|
auto args = tokenizeString<Strings>(editor);
|
|
if (line > 0 && (
|
|
editor.find("emacs") != std::string::npos ||
|
|
editor.find("nano") != std::string::npos ||
|
|
editor.find("vim") != std::string::npos ||
|
|
editor.find("kak") != std::string::npos))
|
|
args.push_back(fmt("+%d", line));
|
|
args.push_back(file);
|
|
return args;
|
|
}
|
|
|
|
}
|