Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/yonicd/rsam
RStudio Addin Manager
https://github.com/yonicd/rsam
Last synced: 16 days ago
JSON representation
RStudio Addin Manager
- Host: GitHub
- URL: https://github.com/yonicd/rsam
- Owner: yonicd
- License: other
- Created: 2017-11-30T03:52:52.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-29T17:08:53.000Z (almost 7 years ago)
- Last Synced: 2024-10-12T21:28:53.231Z (about 1 month ago)
- Language: R
- Size: 71.3 KB
- Stars: 32
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - yonicd/rsam - RStudio Addin Manager (R)
README
---
output:
md_document:
variant: markdown_github
---
[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/0.1.0/active.svg)](http://www.repostatus.org/#active)
[![Travis-CI Build Status](https://travis-ci.org/yonicd/rsam.svg?branch=master)](https://travis-ci.org/yonicd/rsam)[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/yonicd/rsam?branch=master&svg=true)](https://ci.appveyor.com/project/yonicd/rsam)```{r, echo = FALSE, warning=FALSE, message=FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)library(rsam)
library(dplyr)
x <- fetch_addins(fields = c("Package","Name","Binding","Interactive","Key","Shortcut"))x[is.na(x)] <- ''
```
# RStudio Addin Manager
`{rsam}` provides a command line and user interface to manage RStudio addins.
## Installation
Since `{rsam}` manages the rstudio addins it must write to disk.
```{r, eval=FALSE}
remotes::install_github('yonicd/rsam')
```## Permissions
{rsam} needs explicit user permissions to write to disk. There are two questions that need to be answered for the package to run as intended.
- Do you agree to let {rsam} manipulate the addins jsons used to manage RStudio addin keyboard shortcuts?
- Do you agree to let {rsam} duplicate the dcf files of the installed addins in your `.libPaths()` and manipulate them to manage RStudio Addins dropdown list?
Answering the affirmative to both will allow {rsam} to manipulate non R related files. Answering only one will allow for a narrow application of {rsam}.There are two ways to set answers to the questions:
1. On load or attach of the library a prompt is invoked asking the two questions. This is done to set the permissions once a session.
2. Use `rsam::create_yml()` to write _rsam.yml to the home directory `(~)`. In this file there are three fields. When loading {rsam} looks for this file and if it exists then uses the field settings instead of asking questions via prompts.
| Field| Description| Setting|
|--:|--:|--:|
| write_json| Permission to write ~/.R/rstudio/keybindings/addins.json| yes|
| write_dcf | Permission to duplicate and edit rstudio/addins.dcf of installed packages with addins| yes|
| verbose | Permission to run onload/onattach script run with messages to console| yes|## UI
```{r,eval=FALSE}
library(rsam)rsam()
```
[![rsam usage](http://img.youtube.com/vi/-XZWv7CJrs8/0.jpg)](https://www.youtube.com/watch?v=-XZWv7CJrs8)
## CLI
### Retrieve Summary of Installed Addins
```{r,eval=FALSE}
fetch_addins()
``````{r,echo=FALSE}
knitr::kable(x)
```### Building Keyboard Shortcuts
`rsam` has a validation for keyboard keys through the class `key`
```{r}
KEYS$`left command/window key`
KEYS$shift
KEYS$i
key <- KEYS$`left command/window key` + KEYS$shift + KEYS$i
key
```### Set Keyboard Shortcut for Addins
```{r,eval=FALSE}
set_shortcut(fn = 'blogdown::serve_site',shortcut = key)
#if the binding already has a shortcut mapped to it `overide` must be TRUE
set_shortcut(fn = 'blogdown::serve_site',shortcut = key, overide = TRUE)```
### Remove Keyboard Shortcut for Addins
```{r,eval=FALSE}
rm_shortcut(fn = 'blogdown::serve_site')
```### Toggle Addins on/off
Every time a binding is passed to the `toggle_addin` function it will switch states.
```{r,eval=FALSE}
toggle_addin(key = c("blogdown::serve_site","blogdown::new_post_addin","blogdown::update_meta_addin"))
```### Limited Liability Addins
`rsam` gives you 3 empty addins to pass into them whatever you want and run them as your personal addins. You can also set keyboard shortcuts for each one with `set_shortcut`.
Pass through an expression wrapped the global objects `rsam_fn_1()`, `rsam_fn_2()`, and `rsam_fn_3()` into the Rstudio Addin list.
```{r, eval=FALSE}
rsam_fn_1 <- function(){
library(ggplot2)
library(dplyr)
iris%>%ggplot(aes(x=Sepal.Length,y=Sepal.Width)) + geom_point()
}# Change shortcuts to whatever you want
keys <- KEYS$`left command/window key` + KEYS$shift + KEYS$l
rsam::set_shortcut(fn = 'rsam::lla1',shortcut = keys + KEYS$`1`)
rsam::set_shortcut(fn = 'rsam::lla2',shortcut = keys + KEYS$`2`)
rsam::set_shortcut(fn = 'rsam::lla3',shortcut = keys + KEYS$`3`)
```
## Feedbacks and enhancement
You've found a bug, or have an enhancment idea? Feel free to open an issue : [https://github.com/yonicd/rsam/issues](https://github.com/yonicd/rsam/issues).