% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/paintr-addin.R
\name{ptr_wrap_placeholder_addin}
\alias{ptr_wrap_placeholder_addin}
\title{RStudio addin: wrap a selection in a ggpaintr placeholder}
\usage{
ptr_wrap_placeholder_addin()
}
\value{
Invisibly \code{NULL}. Called for its side effect of editing the active
RStudio document.
}
\description{
Interactive RStudio addin. Highlight a token in your ggplot expression
(e.g. \code{mpg} in \code{aes(x = mpg)}), run the addin, and pick a placeholder from
a command-palette gadget; the selection is rewritten to \code{ppVar(mpg)}. With
nothing highlighted the same palette opens and inserts \code{ppVar()} with the
caret between the parens. The placeholder list is read live from the
registry, so custom placeholders registered this session
(via \code{\link[=ptr_define_placeholder_value]{ptr_define_placeholder_value()}} and friends) appear automatically.
}
\details{
The gadget's \emph{Wrap in app} button (left of \emph{Insert}) takes a different
action: instead of inserting a placeholder it wraps the whole selection in a
braced block piped into \code{\link[=ptr_app]{ptr_app()}} --
\verb{\{} / \verb{  <selection>} / \verb{\} |> } / \code{  ptr_app()} -- turning a ggplot
expression into a runnable ggpaintr app skeleton.
}
\section{Theme}{

By default the palette follows your RStudio editor theme (dark theme -> dark
palette, light -> light), via \code{\link[rstudioapi:getThemeInfo]{rstudioapi::getThemeInfo()}}. Force one with
\code{options(ggpaintr.addin_theme = "dark")}, \code{"light"}, or \code{"auto"} (the
default).
}

\section{Keyboard shortcut}{

For a highlight-then-keystroke flow, bind the addin once (RStudio reads
shortcuts only from your own keybindings, so packages cannot ship one). The
addin must be \strong{installed} (not merely \code{load_all()}-ed) to appear in the
shortcut dialog:
\enumerate{
\item \emph{Tools > Addins > Browse Addins...}, then the \emph{Keyboard Shortcuts...}
button. (Or \emph{Tools > Modify Keyboard Shortcuts...} and type "ggpaintr"
in the search box.)
\item Find the \emph{ggpaintr placeholder} row and click its \emph{Shortcut} cell.
\item Press the recommended combination: \strong{Cmd+Shift+G} on macOS,
\strong{Ctrl+Shift+G} on Windows/Linux. (Any free combination works; pick
another if that one is already bound.)
\item \emph{Apply}.
}

Requires \pkg{rstudioapi} and \pkg{miniUI}; it errors with a clear message
when run outside RStudio.
}

