randy3k / R-Box

R package for Sublime Text 3
MIT License
173 stars 27 forks source link

Request: Add keyboard shortcuts #93

Open fangly opened 7 years ago

fangly commented 7 years ago

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:

Cheers, Florent

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

mkirzon commented 7 years ago

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

randy3k commented 7 years ago

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

fangly commented 7 years ago

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.

faridcher commented 6 years ago

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\")" } 
    }
JanaJarecki commented 6 years ago

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

faridcher commented 6 years ago

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
        ]
    }