Open hackergrrl opened 10 years ago
So basically we'd need to add a history
file at ~/.config/replpad/history
see paths.
To save we have two options:
a) append to history every time a command is entered (advantage history preserved if replpad crashes, disadvantage lots of writes) b) (over)write last x commands of history when replpad exits (advantage less writes, disadvantage latest history lost if replpad crashes)
In order to load it, we just have to read the file on start up and initialize the repl history with those commands.
How do we deal with multiline commands, like a function that spans three lines or so. Easiest is just to include these as well, but not sure how useful that is.
There's also the option of writing in batches, either spatially (every 5 or 10 commands run) or temporally (every 1 or 5 minutes).
Yeah, but then we'd still have to write if you close in between an interval - maybe a bit too complex for what we need.
IMO just writing when you close replpad is fine. You should be using it with a file you write to anyways (that's that it's made for) so your code would still be there.
It'd be really swell if I could run
replpad
, do a bunch of hacking, close it, and then, on a subsequent run, scroll back into my command history from that previous run (not unlike how my shell stores old commands in my e.g..zsh_history
file).