-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shrtcts executing multiple shortcuts when only one is called #24
Comments
Hi @danswartcpa! Fortunately, the fix is pretty easy. Each shortcut needs to be encapsulated in a function. The doesn't need to be a named, but it helps and I recommend it: #' SlideInRight
#'
#' SlideInRight
#'
#' @id 1
#' @interactive
#'
slide_in_right <- function() {
sir <- "slideInRight slideOutRight"
rstudioapi::insertText(sir)
}
#' SlideInTop
#'
#' SlideInTop
#'
#' @id 2
#' @interactive
#'
slide_in_top <- function() {
sit <- "slideInTop slideOutTop"
rstudioapi::insertText(sit)
} |
God bless you, Garrick. You are my hero! I go to you first for all my r needs. I know your documentation states that all shrtcts need to be made as a function, but when I saw some of your examples, like for restarting an R session, it appeared that the executable was a strait function call with arguments. I'm too inexperienced to understand what that meant. On YT I've heard you say...I've spent an embarrassing amount of time on this...! Me too on this one. You really put me back on track here. Thank you. Dan Swart |
Awesome, glad that worked and today you learned something new! By the way, if you want a little more inspiration, I just remembered that I added example shrtcts files. Try |
Thank you! I will definitely do that. Mostly I’m putting in shortcuts to functions from your other packages. You’re one of a rare group of highly accomplished people in the world who writes for the beginners and the experts. Practical things! Helpful things. And you respond so quickly it shows a concern and understanding that we’re all feeling some pressure to find solutions quickly.Your fan,DanSent from my iPhoneOn Aug 7, 2023, at 2:32 PM, Garrick Aden-Buie ***@***.***> wrote:
Awesome, glad that worked and today you learned something new! By the way, if you want a little more inspiration, I just remembered that I added example shrtcts files. Try shrtcts::example_shortcuts_r(), which prints out a "starter" shortcuts R script that you can use.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hey, @gadenbuie 👋 |
My apologies; I don't even know if this is a 'bug'. Newbie barely describes my skill level!
When I call a shrtcts (either from the Addins menu, or from a hotkey assigned in RStudio IDE), ALL shortcuts whose execution code uses rstudioapi::insertText() run until they have all run. They even write the specified text in the r chunk when I execute shrtcts::add_rstudio_shortcuts() to rewrite the .shrtcts.R file in the config folder in the home directory. If I add any other shrtcts using rstudioapi::insertText() it just runs that right along with the previous shrtcts. I'm sure I don't understand that function well. It all works for me as you designed it except this one item. I do not use the hotkey assignment feature built in to shrtcts.
Here's the code in the .shrtcts.R file:
Thank you. Dan Swart
The text was updated successfully, but these errors were encountered: