about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--nix-repl.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/nix-repl.cc b/nix-repl.cc
index bb205211793f..bb18359c155e 100644
--- a/nix-repl.cc
+++ b/nix-repl.cc
@@ -71,7 +71,10 @@ bool getLine(string & line)
         if (!s) return false;
         line = chomp(string(s));
         free(s);
-        if (line != "") add_history(line.c_str());
+        if (line != "") {
+            add_history(line.c_str());
+            append_history(1, 0);
+        }
     }
 
     _isInterrupted = 0;
@@ -109,6 +112,9 @@ void NixRepl::mainLoop()
 {
     std::cerr << "Welcome to Nix version " << NIX_VERSION << ". Type :? for help." << std::endl << std::endl;
 
+    using_history();
+    read_history(0);
+
     while (true) {
         string line;
         if (!getLine(line)) break;