snippr (version 0.0.0.9000)

snippets_get: Retrieve a current snippet

Description

Retrieve a current snippet

Usage

snippets_get(name, language = "r", path = snippets_path(language))

Arguments

name

snippet name: if missing, returns a list of all snippets

language

language of the snippet. Choices are "r", "c_cpp", "html", "css", "java", "javascript", "python", and "sql". Ignored if path is specified.

path

path to .snippets file

Details

Note that a .snippets file for a language may not yet exist. If it does not exist, go to Preferences->Code->Edit Snippets in RStudio, make a trivial change to the language of choice (for example, a new empty line), and click Save. This will create the language file in ~/.R/snippets/<language>.snippets with defaults included.

Examples

Run this code
# NOT RUN {
snippet_get("fun")

# assuming a c_cpp .snippets file exists:
snippet_get("cls", language = "c_cpp")

# get a list of all snippets
snippet_get()

# }

Run the code above in your browser using DataCamp Workspace