EXPERIMENTAL
Very rough sketch, many things are likely to change or break.
{tabs} extends {rstudioapi} to be able to conveniently close or move tabs, show diffs between unsaved and saved, restore tabs from cache etc.
Install with:
remotes::install_github("moodymudskipper/tabs")
tabs_
functions mostly take a tidy selection as their main arg, which
is applied on tab names. e.g. tabs_keep(starts_with("a"))
The most important functions:
tabs_keep()
keeps matched tabs opentabs_close()
closes matched tabstabs_select()
keeps matched tabs and attempts to reorder them
(There are some limitation for viewed items than cannot be
recreated)tabs_gather()
moves matched tabs to the right side of the current
tabtabs_open()
opens new tabs by matching file namestabs_resurrect()
brings back scripts that were closed without
being saved but still live in the cache (this one doesn’t use tidy
selection)By default when closing a tab might cause losing unsaved changeds a diff is shown and a choice is proposed.
The usual tidy selection helpers can be used to select by tab name or file name, ignoring the extension.
Other helpers are available :
is_r()
, is_rmd()
restricts selection to R files or Rmd filesext_is()
restricts to file that matches the provided extension
without “.”code_matches()
restricts selection to files whose code matches the
provided patterncode_uses()
restricts selection to R scripts whose code uses the
provided variablestored_in()
restricts selection to files located in a given
directory, optionally recursiveAdd the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.