# Quick disable ----------------------------------------------------------------
# Comment this out and reload R to quickly turn things off.
options(jon_load_stuff = TRUE)
# My settings ------------------------------------------------------------------
# Don't set ANY of these when non-interactive
if (interactive() && getOption("jon_load_stuff", FALSE)) {
## Safer coding --------------------------------------------------------------
options(
warnPartialMatchArgs = TRUE,
warnPartialMatchDollar = TRUE,
warnPartialMatchAttr = TRUE
)
rlang::global_handle()
## Display -------------------------------------------------------------------
options(
continue = " ",
tidymodels.dark = TRUE
)
## usethis -------------------------------------------------------------------
options(
usethis.full_name = "Jon Harmon",
usethis.description = list(
`Authors@R` = 'person("Jon", "Harmon",
email = "jonthegeek@gmail.com",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-4781-4346"))',
License = "MIT + file LICENSE"
),
usethis.destdir = "C:/Users/jonth/Dropbox (Personal)/R"
)
# Some things still want a GITHUB_PAT env var
Sys.setenv(GITHUB_PAT = gitcreds::gitcreds_get()$password)
## Caching -------------------------------------------------------------------
## Technically these COULD change behavior so turn them off if something
## is weird in these packages.
options(
zoom.cache_disk = TRUE,
yt_cache_disk = TRUE,
tigris_use_cache = TRUE,
styler.cache_root = "styler-perm"
)
## Load packages -------------------------------------------------------------
## ONLY load dev-focused packages! Turn these off if you're working on a
## package that wraps any of these!
suppressMessages(require(devtools))
suppressMessages(require(reprex))
suppressMessages(require(andthis)) # My personal usethis extension
## Branch & time in prompt ---------------------------------------------------
## pak::pak("prompt")
prompt::set_prompt(
function(...) {
paste0(
"[",
prompt::git_branch(),
" ",
format(Sys.time(), "%T"),
"] > "
)
}
)
## Check to-dos in new RStudio session ---------------------------------------
setHook(
"rstudio.sessionInit",
function(newSession) {
if (newSession) {
if (length(rstudioapi::getActiveProject())) {
# I want to explicitly exclude revdep from the search.
to_read <- fs::dir_ls(getwd()) |>
stringr::str_subset("revdep$", negate = TRUE)
todor::todor(search_path = to_read)
}
}
},
action = "append"
)
## Current project quick-load ------------------------------------------------
## Name these with . so they don't show up in the global environment
.nectar <- function() {
andthis::open_proj("nectar")
}
.rapid <- function() {
andthis::open_proj("rapid")
}
.bk <- function() {
andthis::open_proj("beekeeper")
}
.api2r <- function() {
.nectar()
.rapid()
.bk()
}
}