When using an R terminal from within vscode, I need to type savehistory()
at the end of my session, before exitting vscode, otherwise my history is lost next time I open the project. I’d like it to be saved automatically when exitting. One possibility would be to automatically run some code when exitting, but I cannot find such configuration option. Actually, I am dubious that this option does not already exit, considering that (I guess) most developers want this. But I cannot find it!
Note that, inspired by this post (or similar ones on the internet), I have tried running the following code in my R terminal under VSCode:
.Last <- function() try(savehistory())
but this does not seem to be ever executed when I quit VSCode. I guess VSCode ends the terminal “too brutally”. (I also tried this variant, to no avail.)
Any help or pointer appreciated.