I would like to see the current working directory at the prompt of my console R. When using options(prompt=paste(getwd(),">> ")) , the working directory is displayed at the beginning of the session. But it never updates when I change the working directory during this session:
/home/sieste >> setwd("newdir") /home/sieste >> cat("damn!\n")
What I'm doing at the moment is to override the setwd function in my .Rprofile
setwd <- function(...) { base::setwd(...) options(prompt=paste(getwd(),">> ")) }
Now the tooltip is updated correctly when I call setwd . My question is: is there a more elegant way to dynamically update a tooltip, regardless of the function I call, and without having to override the base functions?
r command-prompt
sieste
source share