R-Box icon indicating copy to clipboard operation
R-Box copied to clipboard

Request: Add keyboard shortcuts

Open fangly opened this issue 7 years ago • 6 comments

Hi,

Thanks for the good work on R-Box. I use devtools::document(), devtools::build(), devtools::test() and devtools::check() a lot. It would be nice if R-Box had keyboard shorcuts for these operations.

It would be double-nice if these shortcuts were as close as possible to those used in RStudio:

  • source current file: ctrl + shift + S
  • build & reload: ctrl + shift + B
  • load all: ctrl + shift + L
  • test: ctrl + shift + T
  • check: ctrl + shift + E
  • document: ctrl + shift + D
  • render report (rmarkdown, sweave, knitr): ctrl + shift + K

Cheers, Florent

PS/ At the moment, users can probably set up custom R-Box keybindings in: Sublime > Preferences > Key bindings

fangly avatar Mar 15 '17 09:03 fangly

It seems these were implemented. However the shortcuts now clash with native sublime shortcuts and there's no way to overwrite them. For example: Ctrl+Shift+d in Sublime is duplicate selection. However, when R-Extended is selected as the script type, R-Box overwrites that shortcut and sends the Document Package command Similarly with Ctrl+Shift+t, I can no longer open last closed tab when in R-Extended. It sends a repl command instead

mkirzon avatar Mar 28 '17 19:03 mkirzon

They are disabled in the latest release. It should arrive in Package Control soon.

randy3k avatar Mar 28 '17 19:03 randy3k

I mentioned initially that my goal was to set the shortcuts as close as possible to those in RStudio. It's great that @mkirzon is giving feedback on the shortcuts that conflict with those in Sublime. But @randy3k, instead of deleting all these shorcuts, could you please just comment them out? Or even better, find alternatives? Sublime > Preferences > Key binding lists all default key mapping; that can be used to check conflicts.

fangly avatar Mar 30 '17 07:03 fangly

those interested in the r-box keybindings for package development, insert these in the sublime keybinding file:

{ 
    	"keys": ["ctrl+shift+l"], 
    	"command": "r_box_package_send_code", 
    	"args": { "cmd": "devtools::load_all(\"$folder\")" } 
    },
    { 
    	"keys": ["ctrl+shift+b"], 
    	"command": "r_box_package_send_code", 
    	"args": { "cmd": "devtools::install(\"$folder\")" } 
    },
    { 
    	"keys": ["ctrl+shift+e"], 
    	"command": "r_box_package_send_code", 
    	"args": { "cmd": "devtools::check(\"$folder\")" } 
    },
    { 
    	"keys": ["ctrl+shift+d"], 
    	"command": "r_box_package_send_code", 
    	"args": { "cmd": "devtools::document(\"$folder\")" } 
    }

faridcher avatar Sep 20 '17 04:09 faridcher

Hi,

could you be so kind and maybe also provide the code snippet for the .sublime-keymap--User file to define a shortcut for rendering the current rmarkdown document?

Thanks a lot Jana

JanaJarecki avatar Feb 08 '18 09:02 JanaJarecki

Use this for rmakrdown:

{"keys": ["ctrl+shift+k"], "command": "send_code", "args": {"cmd": "browseURL(rmarkdown::render(\"$file\",output_format = "html_document"))" },
        "context":
        [
            { "key": "selector", "operator": "equal", "operand": "text.html.markdown.rmarkdown" }
            //one key per keys
        ]
    }

faridcher avatar Feb 09 '18 01:02 faridcher