diff options
Diffstat (limited to 'nix-repl.cc')
-rw-r--r-- | nix-repl.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nix-repl.cc b/nix-repl.cc index 0c50f4683300..71790eb481a7 100644 --- a/nix-repl.cc +++ b/nix-repl.cc @@ -29,6 +29,9 @@ using namespace nix; #define ESC_CYA "\033[36m" #define ESC_END "\033[0m" +string programId = "nix-repl"; +const string historyFile = string(getenv("HOME")) + "/.nix-repl-history"; + struct NixRepl { string curDir; @@ -127,8 +130,10 @@ void NixRepl::mainLoop(const Strings & files) reloadFiles(); if (!loadedFiles.empty()) std::cout << std::endl; + // Allow nix-repl specific settings in .inputrc + rl_readline_name = "nix-repl"; using_history(); - read_history(0); + read_history(historyFile.c_str()); string input; @@ -708,5 +713,7 @@ int main(int argc, char * * argv) NixRepl repl(searchPath, openStore()); repl.mainLoop(files); + + write_history(historyFile.c_str()); }); } |