Site icon R-bloggers

Modify RStudio prompt to show current git branch

[This article was first published on Rtask, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

You can read the original post in its original format on Rtask website by ThinkR here: Modify RStudio prompt to show current git branch

At the last Raddicts Paris Meetup, Romain Francois (to be followed on twitter here) made one strong impression, among others, with his RStudio console which indicates the active git branch and the RAM memory used by R.

If you too want to have this (to shine in society or because you spend your time doing git checkout):

 

Here is the way to go:

This code to show the active git branch and R memory used needs to be hosted in your ".Rprofile"

prompt::set_prompt(function(...){
paste0(
"[", prompt::git_branch(), prompt::git_dirty(), prompt::git_arrows(), "] ",
prompt::prompt_memuse()
)
})

Tada !

Thanks Romain !!

This post is better presented on its original ThinkR website here: Modify RStudio prompt to show current git branch

To leave a comment for the author, please follow the link and comment on their blog: Rtask.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.