{"id":14070926,"url":"https://github.com/GegznaV/snippets","last_synced_at":"2025-07-30T08:33:27.860Z","repository":{"id":40442998,"uuid":"231820262","full_name":"GegznaV/snippets","owner":"GegznaV","description":":heavy_check_mark: (R package) Manage RStudio snippets","archived":false,"fork":false,"pushed_at":"2024-07-31T20:43:40.000Z","size":593,"stargazers_count":7,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-01T00:20:24.329Z","etag":null,"topics":["r","rstudio","snippets"],"latest_commit_sha":null,"homepage":"https://gegznav.github.io/snippets/","language":"Vim Snippet","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GegznaV.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-01-04T19:55:11.000Z","updated_at":"2024-08-01T00:20:24.330Z","dependencies_parsed_at":"2024-02-29T08:45:16.087Z","dependency_job_id":null,"html_url":"https://github.com/GegznaV/snippets","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GegznaV%2Fsnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GegznaV%2Fsnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GegznaV%2Fsnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GegznaV%2Fsnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GegznaV","download_url":"https://codeload.github.com/GegznaV/snippets/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":215155198,"owners_count":15836926,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["r","rstudio","snippets"],"created_at":"2024-08-13T07:08:11.443Z","updated_at":"2024-12-04T12:33:02.824Z","avatar_url":"https://github.com/GegznaV.png","language":"Vim Snippet","funding_links":[],"categories":["Vim Snippet"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/snippets)](https://CRAN.R-project.org/package=snippets)\n[![GitHub version](https://img.shields.io/badge/GitHub-v`r packageVersion(\"snippets\")`-brightgreen.svg)](https://github.com/GegznaV/snippets)\n[![R build status](https://github.com/GegznaV/snippets/workflows/R-CMD-check/badge.svg)](https://github.com/GegznaV/snippets/actions)\n[![Codecov test coverage](https://codecov.io/gh/GegznaV/snippets/branch/master/graph/badge.svg)](https://codecov.io/gh/GegznaV/snippets?branch=master)\n[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n[![Updated-on](https://img.shields.io/badge/Updated%20on-`r gsub('-', '--', Sys.Date())`-yellowgreen.svg)]()\n\u003c!-- badges: end --\u003e\n\n\n# Package `snippets`\n\n\u003c!-- (`r packageVersion(\"snippets\")`) --\u003e\n\n## Installation\n\n\u003c!-- You can install the released version of snippets from [CRAN](https://CRAN.R-project.org) with: --\u003e\n\n\u003c!-- ``` r --\u003e\n\u003c!-- install.packages(\"snippets\") --\u003e\n\u003c!-- ``` --\u003e\n\nTo install package from CRAN-like repository:\n\n```{r, eval=FALSE}\nrepos \u003c- c(\"https://mokymai.github.io/download/\", getOption(\"repos\"))\ninstall.packages(\"snippets\", repos = repos)\n```\n\nTo install from [GitHub](https://github.com/):\n\n```{r, eval=FALSE}\nif (!require(remotes)) install.packages(\"remotes\")\nremotes::install_github(\"GegznaV/snippets\")\n```\n\n\n## Quickstart\n\n\n### Install Snippets from \"snippets\"\n\n\n```{r eval=FALSE}\n# Replace current files with snippets with those in package \"snippets\"\n# (backup copies are created by default)\nsnippets::install_snippets_from_package(\"snippets\")\n```\n\n\n```{r, include=FALSE, eval=FALSE}\n# Replace current R and Markdown snippets with those in package \"snippets\"\nsnippets::install_snippets_from_package(\"snippets\", type = c(\"r\", \"markdown\"), backup = TRUE)\n```\n\n\n### More Examples\n\n```{r eval=FALSE}\nlibrary(snippets)\n```\n\n```{r eval=FALSE}\n# Get the name of the directory where RStudio snippets are stored\nget_path_rstudio_snippets_dir()\n```\n\n```{r eval=FALSE}\n# Open the directory with RStudio snippets\nopen_rstudio_snippets_dir()\n```\n\n```{r eval=FALSE}\n# Replace your R and Markdown snippets with those in package \"snippets\"\ninstall_snippets_from_package(\"snippets\", type = c(\"r\", \"markdown\"), backup = TRUE)\nlist_snippet_file_backups()\n```\n\n```{r eval=FALSE}\n# View and edit file with snippets of certain type: r\nopen_rstudio_snippets_file(type = \"r\")\n```\n\n```{r eval=FALSE}\n# View and edit file with snippets of certain type: markdown\nopen_rstudio_snippets_file(type = \"markdown\")\n```   \n\n\n### Create and Clean-up Back-ups\n\n```{r eval=FALSE}\n# Create several back up files\nbackup_rstudio_snippets(type = \"r\")\nSys.sleep(1)\nbackup_rstudio_snippets(type = \"r\")\nSys.sleep(1)\nbackup_rstudio_snippets(type = \"r\")\n```\n\n```{r eval=FALSE}\nlist_snippet_file_backups(type = \"r\")\n```\n\n```{r eval=FALSE}\n# Remove duplicated back-up files\nremove_snippet_backup_duplicates()\n```\n\n\n\n\n\u003c!-- \n\n### Revert to a Certain Version of Back-up \n\n1. List all back-up files and select the one of interest.\n    ```{r eval=FALSE}\n    list_snippet_file_backups(type = \"r\")\n    ```\n    ```r\n    #\u003e c:/.R/snippets/r.snippets\n    #\u003e c:/.R/snippets/r.snippets--backup-2019-11-12-033948\n    #\u003e c:/.R/snippets/r.snippets--backup-2019-10-31-015042\n    ```\n2. Restore the back-up of interest, e.g.:\n    ```{r eval=FALSE}\n    restore_snippets_from_backup(\"r.snippets--backup-2019-10-31-015042\")\n    ```\n    ```r\n    #\u003e v Back-up file was found: 'r.snippets--backup-2019-10-31-015042'\n    #\u003e i Snippets' type: r\n    #\u003e v Current 'r.snippets' file was backed up:\n    #\u003e   'r.snippets' -\u003e 'r.snippets--backup-2020-01-05-012602'\n    #\u003e v Snippets were restored from the back-up file:\n    #\u003e   'r.snippets--backup-2019-10-31-015042' -\u003e 'r.snippets'.\n    ```\n--\u003e\n\n\n# Additional resources\n\n## More on using and writing RStudio snippets\n\n1. [Code Snippets](https://support.rstudio.com/hc/en-us/articles/204463668-Code-Snippets)\n   (on RStudio website).\n   All information is relevant to RStudio users.\n2. [R tip: Save time with RStudio code snippets](https://www.youtube.com/watch?v=h_i__VTSurU) \n   (Case study on YouTube).\n3. [Snippets](https://cloud9-sdk.readme.io/docs/snippets) (on Cloud9 SDK website).\n   Advanced topics on writing snippets.\n   Most sections (but not all) are relevant to RStudio users.\n\n\n## Similar projects\n\n1. Package [**snippr**](https://github.com/dgrtwo/snippr).\n\n\n## More snippets\n\n1. [Snippets](https://github.com/dgrtwo/snippets) by @dgrtwo.\n1. [Snippets](https://github.com/gadenbuie/snippets) by @gadenbuie.\n\u003c!-- 2. [R snippets](https://github.com/Hellerz/hellerz/blob/6180ad13d73c7ff826c9cf514840bbbd899d5873/scripts/ace/snippets/r.snippets) by @Hellerz --\u003e\n\u003c!-- 3. [markdown snippets](https://github.com/Hellerz/hellerz/blob/6180ad13d73c7ff826c9cf514840bbbd899d5873/scripts/ace/snippets/markdown.snippets) by @Hellerz --\u003e\n\u003c!-- 4. [R snippets](https://github.com/dick7/vimrc/blob/81a78437c9d6f45c3372e6998f4a8a832890c243/sources_non_forked/vim-snippets/snippets/r.snippets) by @dick7 --\u003e\n\u003c!-- 5. [markdown snippets](https://github.com/dick7/vimrc/blob/81a78437c9d6f45c3372e6998f4a8a832890c243/sources_non_forked/vim-snippets/snippets/markdown.snippets) by @dick7 --\u003e\n\n\u003c!-- \u003cdiv style=\"text-align:right;\"\u003e`r Sys.Date()`\u003c/div\u003e --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGegznaV%2Fsnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGegznaV%2Fsnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGegznaV%2Fsnippets/lists"}