r4fun / keys

:keyboard: Keyboard Shortcuts for 'shiny'
https://r4fun.github.io/keys/
Other
45 stars 6 forks source link

New function to add rstudio-like shortcut keys #12

Open joe-chelladurai opened 3 years ago

joe-chelladurai commented 3 years ago

This may or may not be within the scope of the package, but I was wondering if adding rstudio-like shortcut keys may be valuable in text inputs or for other possible uses. Something like: Ctrl+Shift+M = %>% and Alt+- = <-

tylerlittlefield commented 3 years ago

I haven't thought about it. What use case do you have in mind? The closest you can really get is observing a particular hotkey and updating an input:

library(shiny)
library(keys)
ui <- fluidPage(
  useKeys(),
  keysInput("keys", "command+shift+m"),
  textInput("txt", "txt input")
)

server <- function(input, output, session) {
  observeEvent(input$keys, {
    updateTextInput(session, "txt", value = "%>%")
  })
}

shinyApp(ui, server)
iqis commented 1 year ago

@joe-chelladurai probably more helpful to look at in-browser coder editors?